MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_assert_never_union

Function test_assert_never_union

testing/test_compat.py:214–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

212
213
214def test_assert_never_union() -> None:
215 x: Union[int, str] = 10
216
217 if isinstance(x, int):
218 pass
219 else:
220 with pytest.raises(AssertionError):
221 assert_never(x) # type: ignore[arg-type]
222
223 if isinstance(x, int):
224 pass
225 elif isinstance(x, str):
226 pass
227 else:
228 assert_never(x)
229
230
231def test_assert_never_enum() -> None:

Callers

nothing calls this directly

Calls 1

assert_neverFunction · 0.90

Tested by

no test coverage detected