def test_get__returns_default_for_no_match(self): lookup_fields = ('arg1',) cache = ObjectCache(lookup_fields) obj = MyClass() default = MyClass(1, 2) cache.add(obj) result = cache.get('arg1', None, default) self.assertEqual(default, result)
def test_get(self): lookup_fields = ('arg1',) cache = ObjectCache(lookup_fields) obj = MyClass(1, 2) default = MyClass() cache.add(obj) result = cache.get('arg1', 1, default) self.assertEqual(obj, result)