diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-11-12 23:39:44 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-11-12 23:39:44 +0000 |
commit | e36199b49df77c96bad687c6681d8e54c5053b84 (patch) | |
tree | 81b9aaa74f92b9de459ede5dc6ed2ca4ec508998 /Lib/test/test_compile.py | |
parent | c4cd6d3765d054ac1b23f0f9765a2eaf3f1e7be7 (diff) | |
download | cpython-git-e36199b49df77c96bad687c6681d8e54c5053b84.tar.gz |
fix several compile() issues by translating newlines in the tokenizer
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r-- | Lib/test/test_compile.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py index 75c983a17c..28b73325d8 100644 --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -5,6 +5,19 @@ from test import test_support class TestSpecifics(unittest.TestCase): + def test_no_ending_newline(self): + compile("hi", "<test>", "exec") + compile("hi\r", "<test>", "exec") + + def test_empty(self): + compile("", "<test>", "exec") + + def test_other_newlines(self): + compile("\r\n", "<test>", "exec") + compile("\r", "<test>", "exec") + compile("hi\r\nstuff\r\ndef f():\n pass\r", "<test>", "exec") + compile("this_is\rreally_old_mac\rdef f():\n pass", "<test>", "exec") + def test_debug_assignment(self): # catch assignments to __debug__ self.assertRaises(SyntaxError, compile, '__debug__ = 1', '?', 'single') |