Skip to content
Myr

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 file

Take it

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

Use '%20' for encoding spaces in query parameters. (#2543)Tom Christiebefore adoptiona6af45e

lines 1–60why, one step back
1import httpx
234def 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):56 pass # pragma: no cover5758 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 back
61
6263def 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