test_properties.py
This file
Path
tests/client/test_properties.py
51 lines · 1.6 KiB · Python
Last changed by
#1066 make BaseClient's timeout accessible using getters and setters (#1135)cdelerbefore adoption7123b0f
History of this fileTake it
The walk stopped after 200 commits: lines older than 11e7604 point at it.
#1066 make BaseClient's timeout accessible using getters and setters (#1135)cdelerbefore adoption7123b0f
line 1why, one step back1from httpx import URL, AsyncClient, Cookies, Headers, TimeoutBase URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 2–22why, one step back234def test_client_base_url():5 client = AsyncClient()6 client.base_url = "https://www.example.org/" # type: ignore7 assert isinstance(client.base_url, URL)8 assert client.base_url == URL("https://www.example.org/")91011def test_client_base_url_without_trailing_slash():12 client = AsyncClient()13 client.base_url = "https://www.example.org/path" # type: ignore14 assert isinstance(client.base_url, URL)15 assert client.base_url == URL("https://www.example.org/path/")161718def test_client_base_url_with_trailing_slash():19 client = AsyncClient()20 client.base_url = "https://www.example.org/path/" # type: ignore21 assert isinstance(client.base_url, URL)22 assert client.base_url == URL("https://www.example.org/path/")Sync streaming interface on responses (#695)Tom Christiebefore adoption11e7604
lines 23–26why, one step back232425def test_client_headers():26 client = AsyncClient()Type check tests (#1054)Florimond Mancabefore adoption0296c2b
line 27why, one step back27 client.headers = {"a": "b"} # type: ignoreSync streaming interface on responses (#695)Tom Christiebefore adoption11e7604
lines 28–33why, one step back28 assert isinstance(client.headers, Headers)29 assert client.headers["A"] == "b"303132def test_client_cookies():33 client = AsyncClient()Type check tests (#1054)Florimond Mancabefore adoption0296c2b
line 34why, one step back34 client.cookies = {"a": "b"} # type: ignoreSync streaming interface on responses (#695)Tom Christiebefore adoption11e7604
lines 35–38why, one step back35 assert isinstance(client.cookies, Cookies)36 mycookies = list(client.cookies.jar)37 assert len(mycookies) == 138 assert mycookies[0].name == "a" and mycookies[0].value == "b"#1066 make BaseClient's timeout accessible using getters and setters (#1135)cdelerbefore adoption7123b0f
lines 39–51why, one step back394041def test_client_timeout():42 expected_timeout = 12.043 client = AsyncClient()4445 client.timeout = expected_timeout # type: ignore4647 assert isinstance(client.timeout, 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_timeout