mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
merge 3.2
This commit is contained in:
commit
86f088e8e5
4 changed files with 55 additions and 4 deletions
|
@ -367,6 +367,20 @@ class AST_Tests(unittest.TestCase):
|
|||
compile(m, "<test>", "exec")
|
||||
self.assertIn("but got <_ast.expr", str(cm.exception))
|
||||
|
||||
def test_invalid_identitifer(self):
|
||||
m = ast.Module([ast.Expr(ast.Name(42, ast.Load()))])
|
||||
ast.fix_missing_locations(m)
|
||||
with self.assertRaises(TypeError) as cm:
|
||||
compile(m, "<test>", "exec")
|
||||
self.assertIn("identifier must be of type str", str(cm.exception))
|
||||
|
||||
def test_invalid_string(self):
|
||||
m = ast.Module([ast.Expr(ast.Str(42))])
|
||||
ast.fix_missing_locations(m)
|
||||
with self.assertRaises(TypeError) as cm:
|
||||
compile(m, "<test>", "exec")
|
||||
self.assertIn("string must be of type str", str(cm.exception))
|
||||
|
||||
|
||||
class ASTHelpers_Test(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue