def test_header_set() -> None: updated = False def on_update(_: HeaderSet) -> None: nonlocal updated updated = True header_set = HeaderSet.from_header('GET, HEAD', on_update=on_update) assert header_set.to_header() in {'GET, HEAD', 'HEAD, GET'} assert updated is False header_set.add('PUT') assert updated
def test_header_set() -> None: updated = False def on_update(_: HeaderSet) -> None: nonlocal updated updated = True header_set = HeaderSet.from_header("GET, HEAD", on_update=on_update) assert header_set.to_header() in {"GET, HEAD", "HEAD, GET"} assert updated is False header_set.add("PUT") assert updated