| 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() |