Skip to content
Myr

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 file

Take it

The walk stopped after 200 commits: lines older than 2b92a78 point at it.

Single consistent name for status codes (#1088)Tom Christiebefore adoption35f09d1

lines 1–2why, one step back
1import pytest
2

Drop `Origin` from public API (#688)Andrés Álvarezbefore adoption2b92a78

lines 3–10why, one step back
3import httpx
456def test_status_code_as_int():7 assert httpx.codes.NOT_FOUND == 4048 assert str(httpx.codes.NOT_FOUND) == "404"910

Single consistent name for status codes (#1088)Tom Christiebefore adoption35f09d1

lines 11–18why, one step back
11def test_status_code_value_lookup():
12 assert httpx.codes(404) == 404131415def test_status_code_phrase_lookup():16 assert httpx.codes["NOT_FOUND"] == 4041718

Drop `Origin` from public API (#688)Andrés Álvarezbefore adoption2b92a78

line 19why, one step back
19def test_lowercase_status_code():

Type check tests (#1054)Florimond Mancabefore adoption0296c2b

line 20why, one step back
20 assert httpx.codes.not_found == 404 # type: ignore

Drop `Origin` from public API (#688)Andrés Álvarezbefore adoption2b92a78

lines 21–28why, one step back
21
2223def 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) == ""

Single consistent name for status codes (#1088)Tom Christiebefore adoption35f09d1

lines 29–39why, one step back
29
3031def 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