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

Method run_case

mypyc/test/test_lowering.py:34–61  ·  view source on GitHub ↗
(self, testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

32 base_path = test_temp_dir
33
34 def run_case(self, testcase: DataDrivenTestCase) -> None:
35 options = infer_ir_build_options_from_test_name(testcase.name)
36 if options is None:
37 # Skipped test case
38 return
39 with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase):
40 expected_output = remove_comment_lines(testcase.output)
41 expected_output = replace_word_size(expected_output)
42 try:
43 ir = build_ir_for_single_file(testcase.input, options)
44 except CompileError as e:
45 actual = e.messages
46 else:
47 actual = []
48 for fn in ir:
49 if fn.name == TOP_LEVEL_NAME and not testcase.name.endswith("_toplevel"):
50 continue
51 options = CompilerOptions(strict_traceback_checks=True)
52 # Lowering happens after exception handling and ref count opcodes have
53 # been added. Any changes must maintain reference counting semantics.
54 insert_uninit_checks(fn, True)
55 insert_exception_handling(fn, True)
56 insert_ref_count_opcodes(fn)
57 lower_ir(fn, options)
58 do_flag_elimination(fn, options)
59 actual.extend(format_func(fn))
60
61 assert_test_output(testcase, actual, "Invalid source code output", expected_output)

Callers

nothing calls this directly

Calls 15

use_custom_builtinsFunction · 0.90
remove_comment_linesFunction · 0.90
replace_word_sizeFunction · 0.90
build_ir_for_single_fileFunction · 0.90
CompilerOptionsClass · 0.90
insert_uninit_checksFunction · 0.90
insert_ref_count_opcodesFunction · 0.90
lower_irFunction · 0.90
do_flag_eliminationFunction · 0.90
format_funcFunction · 0.90

Tested by

no test coverage detected