(self)
| 459 | self.assertEqual(txt.read(), "".join(expected)) |
| 460 | |
| 461 | def test_newlines_output(self): |
| 462 | testdict = { |
| 463 | "": b"AAA\nBBB\nCCC\nX\rY\r\nZ", |
| 464 | "\n": b"AAA\nBBB\nCCC\nX\rY\r\nZ", |
| 465 | "\r": b"AAA\rBBB\rCCC\rX\rY\r\rZ", |
| 466 | "\r\n": b"AAA\r\nBBB\r\nCCC\r\nX\rY\r\r\nZ", |
| 467 | } |
| 468 | tests = [(None, testdict[os.linesep])] + sorted(testdict.items()) |
| 469 | for newline, expected in tests: |
| 470 | buf = self.BytesIO() |
| 471 | txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline) |
| 472 | txt.write("AAA\nB") |
| 473 | txt.write("BB\nCCC\n") |
| 474 | txt.write("X\rY\r\nZ") |
| 475 | txt.flush() |
| 476 | self.assertEqual(buf.closed, False) |
| 477 | self.assertEqual(buf.getvalue(), expected) |
| 478 | |
| 479 | def test_destructor(self): |
| 480 | l = [] |
nothing calls this directly
no test coverage detected