(self)
| 443 | self.assertEqual(len(got_lines), len(exp_lines)) |
| 444 | |
| 445 | def test_newlines_input(self): |
| 446 | testdata = b"AAA\nBB\x00B\nCCC\rDDD\rEEE\r\nFFF\r\nGGG" |
| 447 | normalized = testdata.replace(b"\r\n", b"\n").replace(b"\r", b"\n") |
| 448 | for newline, expected in [ |
| 449 | (None, normalized.decode("ascii").splitlines(keepends=True)), |
| 450 | ("", testdata.decode("ascii").splitlines(keepends=True)), |
| 451 | ("\n", ["AAA\n", "BB\x00B\n", "CCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), |
| 452 | ("\r\n", ["AAA\nBB\x00B\nCCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), |
| 453 | ("\r", ["AAA\nBB\x00B\nCCC\r", "DDD\r", "EEE\r", "\nFFF\r", "\nGGG"]), |
| 454 | ]: |
| 455 | buf = self.BytesIO(testdata) |
| 456 | txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline) |
| 457 | self.assertEqual(txt.readlines(), expected) |
| 458 | txt.seek(0) |
| 459 | self.assertEqual(txt.read(), "".join(expected)) |
| 460 | |
| 461 | def test_newlines_output(self): |
| 462 | testdict = { |
nothing calls this directly
no test coverage detected