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

Method test_output

mypy/test/teststubtest.py:2973–3000  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2971
2972class StubtestMiscUnit(unittest.TestCase):
2973 def test_output(self) -> None:
2974 output = run_stubtest(
2975 stub="def bad(number: int, text: str) -> None: ...",
2976 runtime="def bad(num, text): pass",
2977 options=[],
2978 )
2979 expected = (
2980 f'error: {TEST_MODULE_NAME}.bad is inconsistent, stub parameter "number" differs '
2981 'from runtime parameter "num"\n'
2982 f"Stub: in file {TEST_MODULE_NAME}.pyi:1\n"
2983 "def (number: int, text: str)\n"
2984 f"Runtime: in file {TEST_MODULE_NAME}.py:1\ndef (num, text)\n\n"
2985 "Found 1 error (checked 1 module)\n"
2986 )
2987 assert output == expected
2988
2989 output = run_stubtest(
2990 stub="def bad(number: int, text: str) -> None: ...",
2991 runtime="def bad(num, text): pass",
2992 options=["--concise"],
2993 )
2994 expected = (
2995 "{}.bad is inconsistent, "
2996 'stub parameter "number" differs from runtime parameter "num"\n'.format(
2997 TEST_MODULE_NAME
2998 )
2999 )
3000 assert output == expected
3001
3002 def test_reexport_reports_import_location(self) -> None:
3003 with use_tmp_dir(TEST_MODULE_NAME) as tmp_dir:

Callers

nothing calls this directly

Calls 2

run_stubtestFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected