test_status_codes.py
This file
Path
tests/test_status_codes.py
39 lines · 925 bytes · Python
Last changed by
Single consistent name for status codes (#1088)Tom Christiebefore adoption35f09d1
History of this fileTake it
1import pytest23import httpx456def test_status_code_as_int():7 assert httpx.codes.NOT_FOUND == 4048 assert str(httpx.codes.NOT_FOUND) == "404"91011def test_status_code_value_lookup():12 assert httpx.codes(404) == 404131415def test_status_code_phrase_lookup():16 assert httpx.codes["NOT_FOUND"] == 404171819def test_lowercase_status_code():20 assert httpx.codes.not_found == 404 # type: ignore212223def test_reason_phrase_for_status_code():24 assert httpx.codes.get_reason_phrase(404) == "Not Found"252627def test_reason_phrase_for_unknown_status_code():28 assert httpx.codes.get_reason_phrase(499) == ""293031def test_deprecated_status_code_class():32 with pytest.warns(DeprecationWarning):33 assert httpx.StatusCode.NOT_FOUND == 4043435 with pytest.warns(DeprecationWarning):36 assert httpx.StatusCode(404) == 4043738 with pytest.warns(DeprecationWarning):39 assert httpx.StatusCode["NOT_FOUND"] == 404