Пример #1
0
def test_get():
    bc = BlessCache(None, None, BlessCache.CACHEMODE_ENABLED)
    bc.cache = {'foo': 'bar'}
    assert bc.get('foo') == 'bar'
    assert bc.get('DOESNOTEXIST') is None
Пример #2
0
def test_load_cache(tmpdir):
    tmpdir.join('readcache_corrupted').write('{"foo": "bar"}}}')
    bc = BlessCache(str(tmpdir), 'readcache_corrupted',
                    BlessCache.CACHEMODE_ENABLED)
    bar = bc.get('foo')
    assert bar == None
Пример #3
0
def test_get_nocache():
    bc = BlessCache(None, None, BlessCache.CACHEMODE_DISABLED)
    bc.cache = {'foo': 'bar'}
    assert bc.get('foo') is None