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

Method run_case

mypyc/test/test_refcount.py:37–59  ·  view source on GitHub ↗

Perform a runtime checking transformation test case.

(self, testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

35 optional_out = True
36
37 def run_case(self, testcase: DataDrivenTestCase) -> None:
38 """Perform a runtime checking transformation test case."""
39 options = infer_ir_build_options_from_test_name(testcase.name)
40 if options is None:
41 # Skipped test case
42 return
43 with use_custom_builtins(os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase):
44 expected_output = remove_comment_lines(testcase.output)
45 expected_output = replace_word_size(expected_output)
46 try:
47 ir = build_ir_for_single_file(testcase.input, options)
48 except CompileError as e:
49 actual = e.messages
50 else:
51 actual = []
52 for fn in ir:
53 if fn.name == TOP_LEVEL_NAME and not testcase.name.endswith("_toplevel"):
54 continue
55 insert_uninit_checks(fn, True)
56 insert_ref_count_opcodes(fn)
57 actual.extend(format_func(fn))
58
59 assert_test_output(testcase, actual, "Invalid source code output", expected_output)

Callers

nothing calls this directly

Calls 12

use_custom_builtinsFunction · 0.90
remove_comment_linesFunction · 0.90
replace_word_sizeFunction · 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
extendMethod · 0.80
joinMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected