MCPcopy
hub / github.com/encode/httpx / test_httpcore_all_exceptions_mapped

Function test_httpcore_all_exceptions_mapped

tests/test_exceptions.py:14–36  ·  view source on GitHub ↗

All exception classes exposed by HTTPCore are properly mapped to an HTTPX-specific exception class.

()

Source from the content-addressed store, hash-verified

12
13
14def test_httpcore_all_exceptions_mapped() -> None:
15 """
16 All exception classes exposed by HTTPCore are properly mapped to an HTTPX-specific
17 exception class.
18 """
19 expected_mapped_httpcore_exceptions = {
20 value.__name__
21 for _, value in vars(httpcore).items()
22 if isinstance(value, type)
23 and issubclass(value, Exception)
24 and value is not httpcore.ConnectionNotAvailable
25 }
26
27 httpx_exceptions = {
28 value.__name__
29 for _, value in vars(httpx).items()
30 if isinstance(value, type) and issubclass(value, Exception)
31 }
32
33 unmapped_exceptions = expected_mapped_httpcore_exceptions - httpx_exceptions
34
35 if unmapped_exceptions: # pragma: no cover
36 pytest.fail(f"Unmapped httpcore exceptions: {unmapped_exceptions}")
37
38
39def test_httpcore_exception_mapping(server: TestServer) -> None:

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected