(self)
| 17 | |
| 18 | class TestHTTPUtility: |
| 19 | def test_accept(self): |
| 20 | a = http.parse_accept_header("en-us,ru;q=0.5") |
| 21 | assert list(a.values()) == ["en-us", "ru"] |
| 22 | assert a.best == "en-us" |
| 23 | assert a.find("ru") == 1 |
| 24 | pytest.raises(ValueError, a.index, "de") |
| 25 | assert a.to_header() == "en-us,ru;q=0.5" |
| 26 | |
| 27 | def test_accept_parameter_with_space(self): |
| 28 | a = http.parse_accept_header('application/x-special; z="a b";q=0.5') |