def test_finite_dict(): """test DictFiniteCapacity""" d = cache.DictFiniteCapacity(capacity=1) d["a"] = 1 assert d["a"] == 1 d["b"] = 2 assert d["b"] == 2 assert "a" not in d d1 = cache.DictFiniteCapacity(capacity=1) d2 = cache.DictFiniteCapacity(capacity=1) d1["a"] = d2["a"] = 1 assert d1 == d2 d2 = cache.DictFiniteCapacity(capacity=2) d2["a"] = 1 assert d1 != d2
def get_finite_dict(self, name): return cache.DictFiniteCapacity(capacity=1)