Ticket #4041: 4041.diff
| File 4041.diff, 1.0 kB (added by Gary Wilson <gary.wilson@gmail.com>, 2 years ago) |
|---|
-
django/core/cache/backends/base.py
old new 54 54 Returns True if the key is in the cache and has not expired. 55 55 """ 56 56 return self.get(key) is not None 57 58 def __contains__(self, key): 59 """ 60 Allow use of 'in' operator. 61 """ 62 return self.has_key(key) -
tests/regressiontests/cache/tests.py
old new 46 46 self.assertEqual(cache.has_key("hello"), True) 47 47 self.assertEqual(cache.has_key("goodbye"), False) 48 48 49 def test_in(self): 50 # has_key 51 cache.set("hello", "goodbye") 52 self.assertEqual("hello" in cache, True) 53 self.assertEqual("goodbye" in cache, False) 54 49 55 def test_data_types(self): 50 56 # test data types 51 57 stuff = {
