MCPcopy Index your code
hub / github.com/python/cpython / assertASTTransformation

Method assertASTTransformation

Lib/test/test_ast/test_ast.py:3071–3079  ·  view source on GitHub ↗
(self, transformer_class,
                                code, expected_code)

Source from the content-addressed store, hash-verified

3069
3070class NodeTransformerTests(ASTTestMixin, unittest.TestCase):
3071 def assertASTTransformation(self, transformer_class,
3072 code, expected_code):
3073 initial_ast = ast.parse(dedent(code))
3074 expected_ast = ast.parse(dedent(expected_code))
3075
3076 transformer = transformer_class()
3077 result_ast = ast.fix_missing_locations(transformer.visit(initial_ast))
3078
3079 self.assertASTEqual(result_ast, expected_ast)
3080
3081 def test_node_remove_single(self):
3082 code = 'def func(arg) -> SomeType: ...'

Callers 5

test_node_return_listMethod · 0.95
test_node_mutateMethod · 0.95
test_node_replaceMethod · 0.95

Calls 4

dedentFunction · 0.90
assertASTEqualMethod · 0.80
parseMethod · 0.45
visitMethod · 0.45

Tested by

no test coverage detected