* log

* tests

* snapshot tests

* change to richlog

* keep raw lines

* disable highlighting by default

* simplify

* superfluous test

* optimization

* update cell length

* add refresh

* write method

* version bump

* doc fix link

* makes lines private

* docstring

* relax dev dependancy

* remove superfluous code [skip ci]

* added FAQ [skipci]

* fix code in faq [skipci]

* fix typo

* max lines fix
This commit is contained in:
Will McGugan
2023-08-03 10:11:17 +01:00
committed by GitHub
parent b045306c69
commit 879c985296
48 changed files with 3302 additions and 2287 deletions

View File

@@ -240,3 +240,22 @@ def test_fifo_cache_hits():
assert cache.misses == 2
assert str(cache) == "<FIFOCache maxsize=4 hits=3 misses=2>"
def test_discard():
cache = LRUCache(maxsize=3)
cache.set("key1", "value1")
cache.set("key2", "value2")
cache.set("key3", "value3")
assert len(cache) == 3
assert cache.get("key1") == "value1"
cache.discard("key1")
assert len(cache) == 2
assert cache.get("key1") is None
cache.discard("key4") # key that does not exist
assert len(cache) == 2 # size should not change