Skip to content
Myr

Typing: enable strict_equality (#2480)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- ignore mypy when it comes to comparing an IntEnum member with an int - Correct type hint for `test_wsgi_server_port`'s `expected_server_port` parameter.

authored by Martijn Pieters · committed by GitHub · parent 5098f47 · Browse files · 3 files+4 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Tom Christie <tom@tomchristie.com>

Diff stats

3 files+4 added−2 removed

  • tests:+3 added−2 removed
  • other:+1 added−0 removed

3 files+4 added−2 removed

modified:tests/test_status_codes.py+2 added-1 removed
1import httpx234def test_status_code_as_int():5 assert httpx.codes.NOT_FOUND == 4045 # mypy doesn't (yet) recognize that IntEnum members are ints, so ignore it here6 assert httpx.codes.NOT_FOUND == 404 # type: ignore[comparison-overlap]7 assert str(httpx.codes.NOT_FOUND) == "404"8910def test_status_code_value_lookup():
17 unmodified lines
modified:tests/test_wsgi.py+1 added-1 removed
142 unmodified lines
143 pytest.param("https://www.example.org", "443", id="auto-https"),144 pytest.param("http://www.example.org:8000", "8000", id="explicit-port"),145 ],146)147def test_wsgi_server_port(url: str, expected_server_port: int) -> None:147def test_wsgi_server_port(url: str, expected_server_port: str) -> None:148 """149 SERVER_PORT is populated correctly from the requested URL.150 """151 hello_world_app = application_factory([b"Hello, World!"])
12 unmodified lines
modified:setup.cfg+1 added
16 unmodified lines
17strict_concatenate = True18disallow_incomplete_defs = True19no_implicit_reexport = True20warn_return_any = True21strict_equality = True2223[mypy-tests.*]24disallow_untyped_defs = False25check_untyped_defs = True
17 unmodified lines