summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-11-22 20:51:55 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-11-22 20:51:55 (GMT)
commit58e8761da6d11653288b76d2dec6417000a20e74 (patch)
tree6b4ef5c1a8ca1329724cffe07ff34fb5282ba845 /Lib
parent3b1acf11e98bceec44c28d9e6d665e68227d8bf2 (diff)
downloadcpython-58e8761da6d11653288b76d2dec6417000a20e74.zip
cpython-58e8761da6d11653288b76d2dec6417000a20e74.tar.gz
cpython-58e8761da6d11653288b76d2dec6417000a20e74.tar.bz2
Issue #13436: Fix a bogus error message when an AST object was passed
an invalid integer value.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_ast.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index 2ba3ea5..be9f05e 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -486,6 +486,17 @@ class ASTHelpers_Test(unittest.TestCase):
self.assertEqual(ast.literal_eval('10 + 2j'), 10 + 2j)
self.assertEqual(ast.literal_eval('1.5 - 2j'), 1.5 - 2j)
+ def test_bad_integer(self):
+ # issue13436: Bad error message with invalid numeric values
+ body = [ast.ImportFrom(module='time',
+ names=[ast.alias(name='sleep')],
+ level=None,
+ lineno=None, col_offset=None)]
+ mod = ast.Module(body)
+ with self.assertRaises(ValueError) as cm:
+ compile(mod, 'test', 'exec')
+ self.assertIn("invalid integer value: None", str(cm.exception))
+
def test_main():
support.run_unittest(AST_Tests, ASTHelpers_Test)