MCPcopy
hub / github.com/scrapy/scrapy / test_iterables

Method test_iterables

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

Source from the content-addressed store, hash-verified

84 assert h.getlist("X-Forwarded-For") is olist
85
86 def test_iterables(self):
87 idict = {"Content-Type": "text/html", "X-Forwarded-For": ["ip1", "ip2"]}
88
89 h = Headers(idict)
90 assert dict(h) == {
91 b"Content-Type": [b"text/html"],
92 b"X-Forwarded-For": [b"ip1", b"ip2"],
93 }
94 self.assertSortedEqual(h.keys(), [b"X-Forwarded-For", b"Content-Type"])
95 self.assertSortedEqual(
96 h.items(),
97 [(b"X-Forwarded-For", [b"ip1", b"ip2"]), (b"Content-Type", [b"text/html"])],
98 )
99 self.assertSortedEqual(h.values(), [b"ip2", b"text/html"])
100
101 def test_update(self):
102 h = Headers()

Callers

nothing calls this directly

Calls 5

assertSortedEqualMethod · 0.95
itemsMethod · 0.95
valuesMethod · 0.95
HeadersClass · 0.90
keysMethod · 0.80

Tested by

no test coverage detected