test_queryparams.py
This file
Path
tests/client/test_queryparams.py
36 lines · 1.1 KiB · Python
Last changed by
Support Response(text=...), Response(html=...), Response(json=...) (#1297)Tom Christiebefore adoptionf3c2941
History of this fileTake it
The walk stopped after 200 commits: lines older than c143503 point at it.
Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 1why, one step back1import httpxRefactor tests to use `MockTransport(<handler_function>)` (#1281)Tom Christiebefore adoptionc2afd2d
line 2why, one step back2from tests.utils import MockTransportTweak handling of None values in timeout type hints (#992)Florimond Mancabefore adoptionc143503
lines 3–4why, one step back34Refactor tests to use `MockTransport(<handler_function>)` (#1281)Tom Christiebefore adoptionc2afd2d
line 5why, one step back5def hello_world(request: httpx.Request) -> httpx.Response:Support Response(text=...), Response(html=...), Response(json=...) (#1297)Tom Christiebefore adoptionf3c2941
line 6why, one step back6 return httpx.Response(200, text="Hello, world")Tweak handling of None values in timeout type hints (#992)Florimond Mancabefore adoptionc143503
lines 7–9why, one step back789def test_client_queryparams():Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
lines 10–11why, one step back10 client = httpx.Client(params={"a": "b"})11 assert isinstance(client.params, httpx.QueryParams)Tweak handling of None values in timeout type hints (#992)Florimond Mancabefore adoptionc143503
lines 12–15why, one step back12 assert client.params["a"] == "b"131415def test_client_queryparams_string():Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
lines 16–17why, one step back16 client = httpx.Client(params="a=b")17 assert isinstance(client.params, httpx.QueryParams)Tweak handling of None values in timeout type hints (#992)Florimond Mancabefore adoptionc143503
lines 18–19why, one step back18 assert client.params["a"] == "b"19Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 20why, one step back20 client = httpx.Client()Type check tests (#1054)Florimond Mancabefore adoption0296c2b
line 21why, one step back21 client.params = "a=b" # type: ignoreBetter test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 22why, one step back22 assert isinstance(client.params, httpx.QueryParams)Tweak handling of None values in timeout type hints (#992)Florimond Mancabefore adoptionc143503
lines 23–25why, one step back23 assert client.params["a"] == "b"2425Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 26why, one step back26def test_client_queryparams_echo():Tweak handling of None values in timeout type hints (#992)Florimond Mancabefore adoptionc143503
lines 27–29why, one step back27 url = "http://example.org/echo_queryparams"28 client_queryparams = "first=str"29 request_queryparams = {"second": "dict"}Refactor tests to use `MockTransport(<handler_function>)` (#1281)Tom Christiebefore adoptionc2afd2d
lines 30–32why, one step back30 client = httpx.Client(31 transport=MockTransport(hello_world), params=client_queryparams32 )Better test case consistency. Prefer `import httpx` and `httpx.Client`. (#1222)Tom Christiebefore adoption28c7205
line 33why, one step back33 response = client.get(url, params=request_queryparams)Tweak handling of None values in timeout type hints (#992)Florimond Mancabefore adoptionc143503
lines 34–35why, one step back3435 assert response.status_code == 200Replace httpx.URL for str in tests (#1237)Eduardo Enriquezbefore adoptionaad8209
line 36why, one step back36 assert response.url == "http://example.org/echo_queryparams?first=str&second=dict"