MCPcopy Index your code
hub / github.com/numpy/numpy / test_reveal

Function test_reveal

numpy/typing/tests/test_typing.py:165–187  ·  view source on GitHub ↗

Validate that mypy correctly infers the return-types of the expressions in `path`.

(path: str)

Source from the content-addressed store, hash-verified

163@pytest.mark.skipif(NO_MYPY, reason="Mypy is not installed")
164@pytest.mark.parametrize("path", get_test_cases(REVEAL_DIR))
165def test_reveal(path: str) -> None:
166 """Validate that mypy correctly infers the return-types of
167 the expressions in `path`.
168 """
169 __tracebackhide__ = True
170
171 output_mypy = OUTPUT_MYPY
172 if path not in output_mypy:
173 return
174
175 relpath = os.path.relpath(path)
176
177 # collect any reported errors, and clean up the output
178 failures = []
179 for error_line in output_mypy[path]:
180 lineno, error_msg = _strip_filename(error_line)
181 error_msg = textwrap.indent(error_msg, _FAIL_INDENT)
182 reason = _FAIL_MSG_REVEAL.format(relpath, lineno, error_msg)
183 failures.append(reason)
184
185 if failures:
186 reasons = _FAIL_SEP.join(failures)
187 pytest.fail(reasons, pytrace=False)
188
189
190@pytest.mark.filterwarnings("ignore::DeprecationWarning")

Callers

nothing calls this directly

Calls 3

_strip_filenameFunction · 0.85
joinMethod · 0.80
failMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…