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

Function test_semanal_error

mypy/test/testsemanal.py:98–117  ·  view source on GitHub ↗

Perform a test case.

(testcase: DataDrivenTestCase)

Source from the content-addressed store, hash-verified

96
97
98def test_semanal_error(testcase: DataDrivenTestCase) -> None:
99 """Perform a test case."""
100
101 try:
102 src = "\n".join(testcase.input)
103 res = build.build(
104 sources=[BuildSource("main", None, src)],
105 options=get_semanal_options(src, testcase),
106 alt_lib_path=test_temp_dir,
107 )
108 a = res.errors
109 except CompileError as e:
110 # Verify that there was a compile error and that the error messages
111 # are equivalent.
112 a = e.messages
113 if testcase.normalize_output:
114 a = normalize_error_messages(a)
115 assert_string_arrays_equal(
116 testcase.output, a, f"Invalid compiler output ({testcase.file}, line {testcase.line})"
117 )
118
119
120# SymbolNode table export test cases

Callers 1

run_caseMethod · 0.85

Calls 6

BuildSourceClass · 0.90
normalize_error_messagesFunction · 0.90
get_semanal_optionsFunction · 0.85
joinMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…