(self, d: HTTPHeaderDict)
| 267 | assert len(d) == 2 |
| 268 | |
| 269 | def test_header_repeat(self, d: HTTPHeaderDict) -> None: |
| 270 | d["other-header"] = "hello" |
| 271 | d.add("other-header", "world") |
| 272 | |
| 273 | assert list(d.items()) == [ |
| 274 | ("Cookie", "foo"), |
| 275 | ("Cookie", "bar"), |
| 276 | ("other-header", "hello"), |
| 277 | ("other-header", "world"), |
| 278 | ] |
| 279 | |
| 280 | d.add("other-header", "!", combine=True) |
| 281 | expected_results = [ |
| 282 | ("Cookie", "foo"), |
| 283 | ("Cookie", "bar"), |
| 284 | ("other-header", "hello"), |
| 285 | ("other-header", "world, !"), |
| 286 | ] |
| 287 | |
| 288 | assert list(d.items()) == expected_results |
| 289 | # make sure the values persist over copies |
| 290 | assert list(d.copy().items()) == expected_results |
| 291 | |
| 292 | other_dict = HTTPHeaderDict() |
| 293 | # we also need for extensions to properly maintain results |
| 294 | other_dict.extend(d) |
| 295 | assert list(other_dict.items()) == expected_results |
| 296 | |
| 297 | def test_extend_from_headerdict(self, d: HTTPHeaderDict) -> None: |
| 298 | h = HTTPHeaderDict(Cookie="foo", e="foofoo") |
nothing calls this directly
no test coverage detected