Skip to content

Commit 9dc33e8

Browse files
committed
bpo-25643: Refactor the C tokenizer
1 parent af50c84 commit 9dc33e8

File tree

4 files changed

+342
-361
lines changed

4 files changed

+342
-361
lines changed

Lib/test/test_eof.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ def test_line_continuation_EOF_from_file_bpo2180(self):
5555
file_name = script_helper.make_script(temp_dir, 'foo', '\\')
5656
rc, out, err = script_helper.assert_python_failure(file_name)
5757
self.assertIn(b'unexpected EOF while parsing', err)
58-
self.assertIn(b'line 2', err)
58+
self.assertIn(b'line 1', err)
5959
self.assertIn(b'\\', err)
6060

6161
file_name = script_helper.make_script(temp_dir, 'foo', 'y = 6\\')
6262
rc, out, err = script_helper.assert_python_failure(file_name)
6363
self.assertIn(b'unexpected EOF while parsing', err)
64-
self.assertIn(b'line 2', err)
64+
self.assertIn(b'line 1', err)
6565
self.assertIn(b'y = 6\\', err)
6666

6767
if __name__ == "__main__":

Lib/test/test_source_encoding.py

+17
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,23 @@ def test_utf8_bom_and_utf8_coding_line(self):
205205
b'print(ascii("\xc3\xa4"))\n')
206206
self.check_script_output(src, br"'\xe4'")
207207

208+
def test_crlf(self):
209+
src = (b'print(ascii("""\r\n"""))\n')
210+
out = self.check_script_output(src, br"'\n'")
211+
212+
def test_crcrlf(self):
213+
src = (b'print(ascii("""\r\r\n"""))\n')
214+
out = self.check_script_output(src, br"'\n\n'")
215+
216+
def test_crcrcrlf(self):
217+
src = (b'print(ascii("""\r\r\r\n"""))\n')
218+
out = self.check_script_output(src, br"'\n\n\n'")
219+
220+
def test_crcrcrlf2(self):
221+
src = (b'#coding:iso-8859-1\n'
222+
b'print(ascii("""\r\r\r\n"""))\n')
223+
out = self.check_script_output(src, br"'\n\n\n'")
224+
208225

209226
class BytesSourceEncodingTest(AbstractSourceEncodingTest, unittest.TestCase):
210227

0 commit comments

Comments
 (0)