(self)
| 3103 | self.assertEqual(len(got_lines), len(exp_lines)) |
| 3104 | |
| 3105 | def test_newlines_input(self): |
| 3106 | testdata = b"AAA\nBB\x00B\nCCC\rDDD\rEEE\r\nFFF\r\nGGG" |
| 3107 | normalized = testdata.replace(b"\r\n", b"\n").replace(b"\r", b"\n") |
| 3108 | for newline, expected in [ |
| 3109 | (None, normalized.decode("ascii").splitlines(keepends=True)), |
| 3110 | ("", testdata.decode("ascii").splitlines(keepends=True)), |
| 3111 | ("\n", ["AAA\n", "BB\x00B\n", "CCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), |
| 3112 | ("\r\n", ["AAA\nBB\x00B\nCCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), |
| 3113 | ("\r", ["AAA\nBB\x00B\nCCC\r", "DDD\r", "EEE\r", "\nFFF\r", "\nGGG"]), |
| 3114 | ]: |
| 3115 | buf = self.BytesIO(testdata) |
| 3116 | txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline) |
| 3117 | self.assertEqual(txt.readlines(), expected) |
| 3118 | txt.seek(0) |
| 3119 | self.assertEqual(txt.read(), "".join(expected)) |
| 3120 | |
| 3121 | def test_newlines_output(self): |
| 3122 | testdict = { |
nothing calls this directly
no test coverage detected