mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Rich log (#3046)
* 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user