mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #13436: Fix a bogus error message when an AST object was passed
an invalid integer value.
This commit is contained in:
parent
3b1acf11e9
commit
58e8761da6
3 changed files with 15 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue