Ticket #7967: 7967-r8075.diff
File 7967-r8075.diff, 1.5 KB (added by , 16 years ago) |
---|
-
django/core/cache/backends/base.py
63 63 """ 64 64 return self.get(key) is not None 65 65 66 __contains__ = has_key 66 def __contains__(self, key): 67 """ 68 Returns True if the key is in the cache and has not expired. 69 """ 70 # This is a separate method, rather than just a copy of has_key(), 71 # so that it always has the same functionality as has_key(), even 72 # if a subclass overrides it. 73 return self.has_key(key) -
tests/regressiontests/cache/tests.py
56 56 cache.set("hello1", "goodbye1") 57 57 self.assertEqual(cache.has_key("hello1"), True) 58 58 self.assertEqual(cache.has_key("goodbye1"), False) 59 cache.set("empty", None) 60 self.assertEqual(cache.has_key("empty"), True) 59 61 60 62 def test_in(self): 61 63 cache.set("hello2", "goodbye2") 62 64 self.assertEqual("hello2" in cache, True) 63 65 self.assertEqual("goodbye2" in cache, False) 66 cache.set("empty", None) 67 self.assertEqual("empty" in cache, True) 64 68 65 69 def test_data_types(self): 66 70 stuff = {