MCPcopy
hub / github.com/python/mypy / run_case

Method run_case

mypyc/test/test_optimizations.py:35–51  ·  view source on GitHub ↗
(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 with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase):
37 expected_output = remove_comment_lines(testcase.output)
38 try:
39 ir = build_ir_for_single_file(testcase.input)
40 except CompileError as e:
41 actual = e.messages
42 else:
43 actual = []
44 for fn in ir:
45 if fn.name == TOP_LEVEL_NAME and not testcase.name.endswith("_toplevel"):
46 continue
47 insert_uninit_checks(fn, True)
48 self.do_optimizations(fn)
49 actual.extend(format_func(fn))
50
51 assert_test_output(testcase, actual, "Invalid source code output", expected_output)
52
53 def do_optimizations(self, fn: FuncIR) -> None:
54 raise NotImplementedError

Callers

nothing calls this directly

Calls 10

do_optimizationsMethod · 0.95
use_custom_builtinsFunction · 0.90
remove_comment_linesFunction · 0.90
build_ir_for_single_fileFunction · 0.90
insert_uninit_checksFunction · 0.90
format_funcFunction · 0.90
assert_test_outputFunction · 0.90
extendMethod · 0.80
joinMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected