Skip to content
Myr

test_exceptions.py

This file

Path

tests/test_exceptions.py

21 lines · 479 bytes · Python

Last changed by

Add exceptions missing from top-level package (#1045)Florimond Mancabefore adoptionfab4279

History of this file

Take it

1import pytest23import httpx456def test_httpx_exceptions_exposed() -> None:7    """8    All exception classes defined in `httpx._exceptions`9    are exposed as public API.10    """1112    not_exposed = [13        value14        for name, value in vars(httpx._exceptions).items()15        if isinstance(value, type)16        and issubclass(value, Exception)17        and not hasattr(httpx, name)18    ]1920    if not_exposed:21        pytest.fail(f"Unexposed HTTPX exceptions: {not_exposed}")