test_properties.py
This file
Path
tests/client/test_properties.py
68 lines · 2.0 KiB · Python
Last changed by
Add `NetRCAuth()` class. (#2535)Tom Christiebefore adoption59914c7
History of this fileTake it
The walk stopped after 200 commits: lines older than 885314a point at it.
Bump wheel from 0.36.2 to 0.37.0 (#1878)dependabot[bot]before adoption885314a
lines 1–55why, one step back1import httpx234def test_client_base_url():5 client = httpx.Client()6 client.base_url = "https://www.example.org/" # type: ignore7 assert isinstance(client.base_url, httpx.URL)8 assert client.base_url == "https://www.example.org/"91011def test_client_base_url_without_trailing_slash():12 client = httpx.Client()13 client.base_url = "https://www.example.org/path" # type: ignore14 assert isinstance(client.base_url, httpx.URL)15 assert client.base_url == "https://www.example.org/path/"161718def test_client_base_url_with_trailing_slash():19 client = httpx.Client()20 client.base_url = "https://www.example.org/path/" # type: ignore21 assert isinstance(client.base_url, httpx.URL)22 assert client.base_url == "https://www.example.org/path/"232425def test_client_headers():26 client = httpx.Client()27 client.headers = {"a": "b"} # type: ignore28 assert isinstance(client.headers, httpx.Headers)29 assert client.headers["A"] == "b"303132def test_client_cookies():33 client = httpx.Client()34 client.cookies = {"a": "b"} # type: ignore35 assert isinstance(client.cookies, httpx.Cookies)36 mycookies = list(client.cookies.jar)37 assert len(mycookies) == 138 assert mycookies[0].name == "a" and mycookies[0].value == "b"394041def test_client_timeout():42 expected_timeout = 12.043 client = httpx.Client()4445 client.timeout = expected_timeout # type: ignore4647 assert isinstance(client.timeout, httpx.Timeout)48 assert client.timeout.connect == expected_timeout49 assert client.timeout.read == expected_timeout50 assert client.timeout.write == expected_timeout51 assert client.timeout.pool == expected_timeout525354def test_client_event_hooks():55 def on_request(request):use # pragma: no cover instead of # pragma: nocover (#2471)Adrian Garcia Badaraccobefore adoption16e2830
line 56why, one step back56 pass # pragma: no coverBump wheel from 0.36.2 to 0.37.0 (#1878)dependabot[bot]before adoption885314a
lines 57–60why, one step back5758 client = httpx.Client()59 client.event_hooks = {"request": [on_request]}60 assert client.event_hooks == {"request": [on_request], "response": []}Add `NetRCAuth()` class. (#2535)Tom Christiebefore adoption59914c7
lines 61–68why, one step back616263def test_client_trust_env():64 client = httpx.Client()65 assert client.trust_env6667 client = httpx.Client(trust_env=False)68 assert not client.trust_env