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

Function test_assert_never_literal

testing/test_compat.py:249–263  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

247
248
249def test_assert_never_literal() -> None:
250 x: Literal["a", "b"] = "a"
251
252 if x == "a":
253 pass
254 else:
255 with pytest.raises(AssertionError):
256 assert_never(x) # type: ignore[arg-type]
257
258 if x == "a":
259 pass
260 elif x == "b":
261 pass
262 else:
263 assert_never(x)

Callers

nothing calls this directly

Calls 1

assert_neverFunction · 0.90

Tested by

no test coverage detected