def test_flush(self):
     cache = Memory()
     cache['test'] = 'test'
     assert cache.flush()
     assert not cache['test']
 def test_expired(self):
     cache = Memory()
     cache.set('test', 'value', -1)
     assert cache.expired('test')
 def test_set(self):
     cache = Memory()
     cache['test'] = 'test'
     cache.set('expired', 'value', -1)
     assert cache['test'] == 'test'
     assert not cache['expired']
 def test_get(self):
     cache = Memory()
     cache['test'] = 'test'
     assert cache['test'] == 'test'
     assert cache.get('test') == 'test'
     assert cache.get('invalid', 'blah') == 'blah'
Exemple #5
0
 def test_expired(self):
     cache = Memory()
     cache.set('test', 'value', -1)
     assert cache.expired('test')
Exemple #6
0
 def test_contains(self):
     cache = Memory()
     assert not 'test' in cache
     cache['test'] = 'test'
     assert 'test' in cache
Exemple #7
0
 def test_flush(self):
     cache = Memory()
     cache['test'] = 'test'
     assert cache.flush()
     assert not cache['test']
Exemple #8
0
 def test_delete(self):
     cache = Memory()
     cache['test'] = 'test'
     assert cache['test'] == 'test'
     del cache['test']
     assert not cache['test']
Exemple #9
0
 def test_get(self):
     cache = Memory()
     cache['test'] = 'test'
     assert cache['test'] == 'test'
     assert cache.get('test') == 'test'
     assert cache.get('invalid', 'blah') == 'blah'
Exemple #10
0
 def test_set(self):
     cache = Memory()
     cache['test'] = 'test'
     cache.set('expired', 'value', -1)
     assert cache['test'] == 'test'
     assert not cache['expired']
Exemple #11
0
 def test_create(self):
     cache = Memory()
     assert repr(cache) == '<watson.cache.storage.Memory>'