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

Method test_snippets

Lib/test/test_ast/test_ast.py:129–139  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

127 self.assertIsNone(ref())
128
129 def test_snippets(self):
130 for input, output, kind in ((exec_tests, exec_results, "exec"),
131 (single_tests, single_results, "single"),
132 (eval_tests, eval_results, "eval")):
133 for i, o in zip(input, output):
134 with self.subTest(action="parsing", input=i):
135 ast_tree = compile(i, "?", kind, ast.PyCF_ONLY_AST)
136 self.assertEqual(to_tuple(ast_tree), o)
137 self._assertTrueorder(ast_tree, (0, 0))
138 with self.subTest(action="compiling", input=i, kind=kind):
139 compile(ast_tree, "?", kind)
140
141 def test_ast_validation(self):
142 # compile() is the only function that calls PyAST_Validate

Callers

nothing calls this directly

Calls 5

_assertTrueorderMethod · 0.95
to_tupleFunction · 0.90
subTestMethod · 0.80
compileFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected