test_properties.py
This file
Path
tests/client/test_properties.py
38 lines · 1.2 KiB · Python
Last changed by
Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
History of this fileTake it
The walk stopped after 200 commits: lines older than 11e7604 point at it.
Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6
lines 1–22why, one step back1from httpx import URL, AsyncClient, Cookies, Headers234def 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"