MCPcopy Index your code
hub / github.com/pydata/xarray / test_update_priority

Function test_update_priority

xarray/tests/test_backends_lru_cache.py:41–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39
40
41def 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
54def test_del() -> None:

Callers

nothing calls this directly

Calls 2

LRUCacheClass · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…