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

Method run_case

mypyc/test/test_exceptions.py:35–56  ·  view source on GitHub ↗

Perform a runtime checking transformation test case.

(self, testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

33 base_path = test_temp_dir
34
35 def run_case(self, testcase: DataDrivenTestCase) -> None:
36 """Perform a runtime checking transformation test case."""
37 with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase):
38 expected_output = remove_comment_lines(testcase.output)
39 try:
40 ir = build_ir_for_single_file(testcase.input)
41 except CompileError as e:
42 actual = e.messages
43 else:
44 actual = []
45 for fn in ir:
46 if fn.name == TOP_LEVEL_NAME and not testcase.name.endswith("_toplevel"):
47 continue
48 insert_uninit_checks(fn, True)
49 insert_exception_handling(fn, True)
50 insert_ref_count_opcodes(fn)
51 actual.extend(format_func(fn))
52 if testcase.name.endswith("_freq"):
53 common = frequently_executed_blocks(fn.blocks[0])
54 actual.append("hot blocks: %s" % sorted(b.label for b in common))
55
56 assert_test_output(testcase, actual, "Invalid source code output", expected_output)

Callers

nothing calls this directly

Calls 14

use_custom_builtinsFunction · 0.90
remove_comment_linesFunction · 0.90
build_ir_for_single_fileFunction · 0.90
insert_uninit_checksFunction · 0.90
insert_ref_count_opcodesFunction · 0.90
format_funcFunction · 0.90
assert_test_outputFunction · 0.90
sortedFunction · 0.85
extendMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected