| 92 | |
| 93 | @pytest.mark.flaky(reruns=3, reruns_delay=2) |
| 94 | def test_edge_cases(): |
| 95 | h = HeaderMap() |
| 96 | h.remove("nope") |
| 97 | assert h.get("nope") is None |
| 98 | assert list(h.get_all("nope")) == [] |
| 99 | try: |
| 100 | del h["nope"] |
| 101 | except KeyError: |
| 102 | pass |
| 103 | h.append("X", "1") |
| 104 | assert h["X"] == b"1" |
| 105 | h.append("X", "2") |
| 106 | # hash is randomized, so we check both possible orders |
| 107 | assert len(h) == 2 |
| 108 | assert (list(h.get_all("X")) == [b"1", b"2"]) or ( |
| 109 | list(h.get_all("X")) == [b"2", b"1"] |
| 110 | ) |
| 111 | |
| 112 | |
| 113 | @pytest.mark.flaky(reruns=3, reruns_delay=2) |