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

Method run_case

mypyc/test/test_irbuild.py:80–104  ·  view source on GitHub ↗

Perform a runtime checking transformation test case.

(self, testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

78 optional_out = True
79
80 def run_case(self, testcase: DataDrivenTestCase) -> None:
81 """Perform a runtime checking transformation test case."""
82 options = infer_ir_build_options_from_test_name(testcase.name)
83 if options is None:
84 # Skipped test case
85 return
86 if "_withgil" in testcase.name and IS_FREE_THREADED:
87 # Test case should only run on a non-free-threaded build.
88 return
89 with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase):
90 expected_output = remove_comment_lines(testcase.output)
91 expected_output = replace_word_size(expected_output)
92 name = testcase.name
93 try:
94 ir = build_ir_for_single_file(testcase.input, options)
95 except CompileError as e:
96 actual = e.messages
97 else:
98 actual = []
99 for fn in ir:
100 if fn.name == TOP_LEVEL_NAME and not name.endswith("_toplevel"):
101 continue
102 actual.extend(format_func(fn))
103
104 assert_test_output(testcase, actual, "Invalid source code output", expected_output)

Callers

nothing calls this directly

Calls 10

use_custom_builtinsFunction · 0.90
remove_comment_linesFunction · 0.90
replace_word_sizeFunction · 0.90
build_ir_for_single_fileFunction · 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