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

Method test_iterables

tests/test_http_headers.py:86–99  ·  tests/test_http_headers.py::TestHeaders.test_iterables
(self)

Source from the content-addressed store, hash-verified

84 assert h.getlist(class="st">"X-Forwarded-For") is olist
85
86 def test_iterables(self):
87 idict = {class="st">"Content-Type": class="st">"text/html", class="st">"X-Forwarded-For": [class="st">"ip1", class="st">"ip2"]}
88
89 h = Headers(idict)
90 assert dict(h) == {
91 bclass="st">"Content-Type": [bclass="st">"text/html"],
92 bclass="st">"X-Forwarded-For": [bclass="st">"ip1", bclass="st">"ip2"],
93 }
94 self.assertSortedEqual(h.keys(), [bclass="st">"X-Forwarded-For", bclass="st">"Content-Type"])
95 self.assertSortedEqual(
96 h.items(),
97 [(bclass="st">"X-Forwarded-For", [bclass="st">"ip1", bclass="st">"ip2"]), (bclass="st">"Content-Type", [bclass="st">"text/html"])],
98 )
99 self.assertSortedEqual(h.values(), [bclass="st">"ip2", bclass="st">"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