Skip to content
Snippets Groups Projects
Commit 7a2f8202 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Tests for cache

parent 6c383b07
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,18 @@ def test_clear():
for i in range(sz):
with pytest.raises(KeyError):
c.get(i)
def test_getitem_setitem():
c = cache.Cache()
c['abc'] = 123
assert c.get('abc') == 123
c.put(123, 'abc')
assert c[123] == 'abc'
with pytest.raises(KeyError):
c['notakey']
def test_getdefault():
c = cache.Cache()
......@@ -81,7 +92,7 @@ def test_getdefault():
c.get('non_existent', 'default', 'badarg')
c.get('non_existent', 'default', badarg='badarg')
c.get('non_existent', 'badarg', default='default')
c.get('non_existent', default='default', badarg='badarg')
c.get('non_existent', default='default', badarg='badarg')
def test_expiry():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment