diff options
author | Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com> | 2020-03-16 08:12:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 08:12:53 (GMT) |
commit | 4ab362cec6dc68c798b3e354f687cf39e207b9a9 (patch) | |
tree | fd3e04e72101bda5ade2fc0ee4437974a53daa9b /Lib/test/test_ast.py | |
parent | 5b66ec166b81c8a77286da2c0d17be3579c3069a (diff) | |
download | cpython-4ab362cec6dc68c798b3e354f687cf39e207b9a9.zip cpython-4ab362cec6dc68c798b3e354f687cf39e207b9a9.tar.gz cpython-4ab362cec6dc68c798b3e354f687cf39e207b9a9.tar.bz2 |
bpo-39638: Keep ASDL signatures in the AST nodes (GH-18515)
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r-- | Lib/test/test_ast.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 0058e93..66f8384 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -636,6 +636,16 @@ class AST_Tests(unittest.TestCase): attr_b = tree.body[0].decorator_list[0].value self.assertEqual(attr_b.end_col_offset, 4) + def test_ast_asdl_signature(self): + self.assertEqual(ast.withitem.__doc__, "withitem(expr context_expr, expr? optional_vars)") + self.assertEqual(ast.GtE.__doc__, "GtE") + self.assertEqual(ast.Name.__doc__, "Name(identifier id, expr_context ctx)") + self.assertEqual(ast.cmpop.__doc__, "cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn") + expressions = [f" | {node.__doc__}" for node in ast.expr.__subclasses__()] + expressions[0] = f"expr = {ast.expr.__subclasses__()[0].__doc__}" + self.assertCountEqual(ast.expr.__doc__.split("\n"), expressions) + + class ASTHelpers_Test(unittest.TestCase): maxDiff = None |