MCPcopy Index your code
hub / github.com/RustPython/RustPython / _assertTrueorder

Method _assertTrueorder

Lib/test/test_ast/test_ast.py:67–84  ·  view source on GitHub ↗
(self, ast_node, parent_pos)

Source from the content-addressed store, hash-verified

65 return name != 'AST' and name[0].isupper()
66
67 def _assertTrueorder(self, ast_node, parent_pos):
68 if not isinstance(ast_node, ast.AST) or ast_node._fields is None:
69 return
70 if isinstance(ast_node, (ast.expr, ast.stmt, ast.excepthandler)):
71 node_pos = (ast_node.lineno, ast_node.col_offset)
72 self.assertGreaterEqual(node_pos, parent_pos)
73 parent_pos = (ast_node.lineno, ast_node.col_offset)
74 for name in ast_node._fields:
75 value = getattr(ast_node, name)
76 if isinstance(value, list):
77 first_pos = parent_pos
78 if value and name == 'decorator_list':
79 first_pos = (value[0].lineno, value[0].col_offset)
80 for child in value:
81 self._assertTrueorder(child, first_pos)
82 elif value is not None:
83 self._assertTrueorder(value, parent_pos)
84 self.assertEqual(ast_node._fields, ast_node.__match_args__)
85
86 def test_AST_objects(self):
87 x = ast.AST()

Callers 1

test_snippetsMethod · 0.95

Calls 4

isinstanceFunction · 0.85
getattrFunction · 0.85
assertGreaterEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected