()
| 39 | |
| 40 | |
| 41 | def test_update_priority() -> None: |
| 42 | cache: LRUCache[Any, Any] = LRUCache(maxsize=2) |
| 43 | cache["x"] = 1 |
| 44 | cache["y"] = 2 |
| 45 | assert list(cache) == ["x", "y"] |
| 46 | assert "x" in cache # contains |
| 47 | assert list(cache) == ["y", "x"] |
| 48 | assert cache["y"] == 2 # getitem |
| 49 | assert list(cache) == ["x", "y"] |
| 50 | cache["x"] = 3 # setitem |
| 51 | assert list(cache.items()) == [("y", 2), ("x", 3)] |
| 52 | |
| 53 | |
| 54 | def test_del() -> None: |