MCPcopy
hub / github.com/pytest-dev/pytest / test_assert_never_union

Function test_assert_never_union

testing/test_compat.py:143–157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141
142
143def test_assert_never_union() -> None:
144 x: int | str = 10
145
146 if isinstance(x, int):
147 pass
148 else:
149 with pytest.raises(AssertionError):
150 assert_never(x) # type: ignore[arg-type]
151
152 if isinstance(x, int):
153 pass
154 elif isinstance(x, str):
155 pass
156 else:
157 assert_never(x)
158
159
160def test_assert_never_enum() -> None:

Callers

nothing calls this directly

Calls 1

assert_neverFunction · 0.90

Tested by

no test coverage detected