mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
bpo-39638: Keep ASDL signatures in the AST nodes (GH-18515)
This commit is contained in:
parent
5b66ec166b
commit
4ab362cec6
7 changed files with 343 additions and 132 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue