Skip to content
Myr

test_properties.py

This file

Path

tests/client/test_properties.py

60 lines · 1.9 KiB · Python

Last changed by

Event hooks (#1246)Tom Christiebefore adoption54f7708

History of this file

Take it

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

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 1why, one step back
1import httpx

Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6

lines 2–4why, one step back
2
34def test_client_base_url():

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 5why, one step back
5 client = httpx.Client()

Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6

line 6why, one step back
6 client.base_url = "https://www.example.org/" # type: ignore

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 7why, one step back
7 assert isinstance(client.base_url, httpx.URL)

Replace httpx.URL for str in tests (#1237)Eduardo Enriquezbefore adoptionaad8209

line 8why, one step back
8 assert client.base_url == "https://www.example.org/"

Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6

lines 9–11why, one step back
9
1011def test_client_base_url_without_trailing_slash():

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 12why, one step back
12 client = httpx.Client()

Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6

line 13why, one step back
13 client.base_url = "https://www.example.org/path" # type: ignore

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 14why, one step back
14 assert isinstance(client.base_url, httpx.URL)

Replace httpx.URL for str in tests (#1237)Eduardo Enriquezbefore adoptionaad8209

line 15why, one step back
15 assert client.base_url == "https://www.example.org/path/"

Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6

lines 16–18why, one step back
16
1718def test_client_base_url_with_trailing_slash():

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 19why, one step back
19 client = httpx.Client()

Base URL improvements (#1130)Tom Christiebefore adoptiona3392c6

line 20why, one step back
20 client.base_url = "https://www.example.org/path/" # type: ignore

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 21why, one step back
21 assert isinstance(client.base_url, httpx.URL)

Replace httpx.URL for str in tests (#1237)Eduardo Enriquezbefore adoptionaad8209

line 22why, one step back
22 assert client.base_url == "https://www.example.org/path/"

Fix VERSION_FILE in publish script. (#916)Tom Christiebefore adoption3010261

lines 23–25why, one step back
23
2425def test_client_headers():

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 26why, one step back
26 client = httpx.Client()

Type check tests (#1054)Florimond Mancabefore adoption0296c2b

line 27why, one step back
27 client.headers = {"a": "b"} # type: ignore

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 28why, one step back
28 assert isinstance(client.headers, httpx.Headers)

Fix VERSION_FILE in publish script. (#916)Tom Christiebefore adoption3010261

lines 29–32why, one step back
29 assert client.headers["A"] == "b"
303132def test_client_cookies():

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 33why, one step back
33 client = httpx.Client()

Type check tests (#1054)Florimond Mancabefore adoption0296c2b

line 34why, one step back
34 client.cookies = {"a": "b"} # type: ignore

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 35why, one step back
35 assert isinstance(client.cookies, httpx.Cookies)

Fix VERSION_FILE in publish script. (#916)Tom Christiebefore adoption3010261

lines 36–38why, one step back
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–42why, one step back
39
4041def test_client_timeout():42 expected_timeout = 12.0

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 43why, one step back
43 client = httpx.Client()

#1066 make BaseClient's timeout accessible using getters and setters (#1135)cdelerbefore adoption7123b0f

lines 44–46why, one step back
44
45 client.timeout = expected_timeout # type: ignore46

Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205

line 47why, one step back
47 assert isinstance(client.timeout, httpx.Timeout)

#1066 make BaseClient's timeout accessible using getters and setters (#1135)cdelerbefore adoption7123b0f

lines 48–51why, one step back
48 assert client.timeout.connect == expected_timeout
49 assert client.timeout.read == expected_timeout50 assert client.timeout.write == expected_timeout51 assert client.timeout.pool == expected_timeout

Event hooks (#1246)Tom Christiebefore adoption54f7708

lines 52–60why, one step back
52
5354def test_client_event_hooks():55 def on_request(request):56 pass # pragma: nocover5758 client = httpx.Client()59 client.event_hooks = {"request": [on_request]}60 assert client.event_hooks == {"request": [on_request], "response": []}