summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 4e29eab..b5949fd 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -36,6 +36,9 @@ class TestSpecifics(unittest.TestCase):
def test_syntax_error(self):
self.assertRaises(SyntaxError, compile, "1+*3", "filename", "exec")
+ def test_none_keyword_arg(self):
+ self.assertRaises(SyntaxError, compile, "f(None=1)", "<string>", "exec")
+
def test_duplicate_global_local(self):
try:
exec('def f(a): global a; a = 1')
@@ -158,21 +161,22 @@ if 1:
def test_literals_with_leading_zeroes(self):
for arg in ["077787", "0xj", "0x.", "0e", "090000000000000",
- "080000000000000", "000000000000009", "000000000000008"]:
+ "080000000000000", "000000000000009", "000000000000008",
+ "0b42", "0BADCAFE", "0o123456789", "0b1.1", "0o4.2",
+ "0b101j2", "0o153j2", "0b100e1", "0o777e1", "0777",
+ "000777", "000000000000007"]:
self.assertRaises(SyntaxError, eval, arg)
- self.assertEqual(eval("0777"), 511)
- self.assertEqual(eval("000777"), 511)
self.assertEqual(eval("0xff"), 255)
- self.assertEqual(eval("0XfF"), 255)
self.assertEqual(eval("0777."), 777)
self.assertEqual(eval("0777.0"), 777)
self.assertEqual(eval("000000000000000000000000000000000000000000000000000777e0"), 777)
self.assertEqual(eval("0777e1"), 7770)
self.assertEqual(eval("0e0"), 0)
- self.assertEqual(eval("0000E-012"), 0)
+ self.assertEqual(eval("0000e-012"), 0)
self.assertEqual(eval("09.5"), 9.5)
self.assertEqual(eval("0777j"), 777j)
+ self.assertEqual(eval("000"), 0)
self.assertEqual(eval("00j"), 0j)
self.assertEqual(eval("00.0"), 0)
self.assertEqual(eval("0e3"), 0)
@@ -181,9 +185,12 @@ if 1:
self.assertEqual(eval("090000000000000e0"), 90000000000000.)
self.assertEqual(eval("090000000000000e-0"), 90000000000000.)
self.assertEqual(eval("090000000000000j"), 90000000000000j)
- self.assertEqual(eval("000000000000007"), 7)
self.assertEqual(eval("000000000000008."), 8.)
self.assertEqual(eval("000000000000009."), 9.)
+ self.assertEqual(eval("0b101010"), 42)
+ self.assertEqual(eval("-0b000000000010"), -2)
+ self.assertEqual(eval("0o777"), 511)
+ self.assertEqual(eval("-0o0000010"), -8)
def test_unary_minus(self):
# Verify treatment of unary minus on negative numbers SF bug #660455