MCPcopy
hub / github.com/scrapy/scrapy / test_basics

Method test_basics

tests/test_http_headers.py:12–27  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

10 assert sorted(first) == sorted(second), msg
11
12 def test_basics(self):
13 h = Headers({"Content-Type": "text/html", "Content-Length": 1234})
14 assert h["Content-Type"]
15 assert h["Content-Length"]
16
17 with pytest.raises(KeyError):
18 h["Accept"]
19 assert h.get("Accept") is None
20 assert h.getlist("Accept") == []
21
22 assert h.get("Accept", "*/*") == b"*/*"
23 assert h.getlist("Accept", "*/*") == [b"*/*"]
24 assert h.getlist("Accept", ["text/html", "images/jpeg"]) == [
25 b"text/html",
26 b"images/jpeg",
27 ]
28
29 def test_single_value(self):
30 h = Headers()

Callers

nothing calls this directly

Calls 3

getMethod · 0.95
getlistMethod · 0.95
HeadersClass · 0.90

Tested by

no test coverage detected