Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)
Currently CacheWrap acts like a NonPersistentCache by default, but it might change
in the future.

src/p/y/py_cache_manager-HEAD/tests/wrap_tests.py   py_cache_manager(Download)
import unittest
from cacheman import cacher
from cacheman.cachewrap import CacheWrap, NonPersistentCache, PersistentCache
from common import CacheCommonAsserter
 
    def test_non_persistent_cache_wrap(self):
        cache_name = 'cache_wrap'
 
        cache = NonPersistentCache(cache_name, cache_manager=self.manager, contents={})
        cache['foo'] = 'bar'
    def test_build_on_init(self):
        cache_name = self.check_cache_gone('built')
        cache = NonPersistentCache(cache_name, cache_manager=self.manager, loader=None,
            builder=lambda *args: [])
        self.assertTrue(isinstance(cache.contents, list))
    def test_contains(self):
        cache_name = self.check_cache_gone('contains')
        cache = NonPersistentCache(cache_name, cache_manager=self.manager, contents={ 'foo': 'bar' })
        self.assertTrue('foo' in cache)
        self.assertFalse('foo2' in cache)