def test_cache_manager_caches(): """Test that CacheManager can return a list of caches.""" settings = {str(n): {} for n in range(5)} cacheman = CacheManager(settings) caches = cacheman.caches() assert isinstance(caches, list) assert len(caches) == len(settings) for _, cache in cacheman: assert cache in caches
def __init__(self): pass def source(self): ca = CacheManager({ "a": { "maxsize": CacheAdapter.__maxsize }, "b": { "maxsize": CacheAdapter.__maxsize } }) CacheAdapter() from cacheout import CacheManager class C: a = 0 b = 100 ca = CacheManager({"a": {"maxsize": 100}, "b": {"maxsize": 100}}) ca["a"].set("name", "andy") ca["a"].set("name1", C()) x = ca.caches()[1].get("name1").a print(x)