summaryrefslogtreecommitdiff
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-11-13 00:17:59 +0000
committerBenjamin Peterson <benjamin@python.org>2009-11-13 00:17:59 +0000
commitaeaa592516c8ea8a0a6318f69635baa817ced82f (patch)
tree7b082d501188cc6acc44469e7f33a766c51d9d55 /Lib/test/test_compile.py
parenta1d23326b19a0182ef74aae32386c5119b1a6e39 (diff)
downloadcpython-git-aeaa592516c8ea8a0a6318f69635baa817ced82f.tar.gz
Merged revisions 76230 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r76230 | benjamin.peterson | 2009-11-12 17:39:44 -0600 (Thu, 12 Nov 2009) | 2 lines 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.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 32dd656e53..563a7eec63 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -5,6 +5,19 @@ from test import 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')