MCPcopy Index your code
hub / github.com/python/mypy / run_case

Method run_case

mypyc/test/test_alwaysdefined.py:26–46  ·  view source on GitHub ↗

Perform a runtime checking transformation test case.

(self, testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

24 base_path = test_temp_dir
25
26 def run_case(self, testcase: DataDrivenTestCase) -> None:
27 """Perform a runtime checking transformation test case."""
28 options = infer_ir_build_options_from_test_name(testcase.name)
29 if options is None:
30 # Skipped test case
31 return
32 with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase):
33 try:
34 ir = build_ir_for_single_file2(testcase.input, options)[0]
35 except CompileError as e:
36 actual = e.messages
37 else:
38 actual = []
39 for cl in ir.classes:
40 if cl.name.startswith("_"):
41 continue
42 actual.append(
43 "{}: [{}]".format(cl.name, ", ".join(sorted(cl._always_initialized_attrs)))
44 )
45
46 assert_test_output(testcase, actual, "Invalid test output", testcase.output)

Callers

nothing calls this directly

Calls 9

use_custom_builtinsFunction · 0.90
assert_test_outputFunction · 0.90
sortedFunction · 0.85
appendMethod · 0.80
joinMethod · 0.45
startswithMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected