mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
bpo-39999: Improve compatibility of the ast module. (GH-19056)
* Re-add removed classes Suite, slice, Param, AugLoad and AugStore. * Add docstrings for dummy classes. * Add docstrings for attribute aliases. * Set __module__ to "ast" instead of "_ast".
This commit is contained in:
parent
044cf94f61
commit
bace59d8b8
10 changed files with 49 additions and 22 deletions
|
@ -283,7 +283,7 @@ class AST_Tests(unittest.TestCase):
|
|||
x.vararg
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
# "_ast.AST constructor takes 0 positional arguments"
|
||||
# "ast.AST constructor takes 0 positional arguments"
|
||||
ast.AST(2)
|
||||
|
||||
def test_AST_garbage_collection(self):
|
||||
|
@ -573,7 +573,7 @@ class AST_Tests(unittest.TestCase):
|
|||
m = ast.Module([ast.Expr(ast.expr(**pos), **pos)], [])
|
||||
with self.assertRaises(TypeError) as cm:
|
||||
compile(m, "<test>", "exec")
|
||||
self.assertIn("but got <_ast.expr", str(cm.exception))
|
||||
self.assertIn("but got <ast.expr", str(cm.exception))
|
||||
|
||||
def test_invalid_identifier(self):
|
||||
m = ast.Module([ast.Expr(ast.Name(42, ast.Load()))], [])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue