MCPcopy
hub / github.com/django/django / test_expiration

Method test_expiration

tests/cache/tests.py:214–225  ·  view source on GitHub ↗

Expiration has no effect on the dummy cache

(self)

Source from the content-addressed store, hash-verified

212 self.assertIsNone(cache.get(key))
213
214 def test_expiration(self):
215 "Expiration has no effect on the dummy cache"
216 cache.set("expire1", "very quickly", 1)
217 cache.set("expire2", "very quickly", 1)
218 cache.set("expire3", "very quickly", 1)
219
220 time.sleep(2)
221 self.assertIsNone(cache.get("expire1"))
222
223 self.assertIs(cache.add("expire2", "newvalue"), True)
224 self.assertIsNone(cache.get("expire2"))
225 self.assertIs(cache.has_key("expire3"), False)
226
227 def test_unicode(self):
228 "Unicode values are ignored by the dummy cache"

Callers

nothing calls this directly

Calls 5

sleepMethod · 0.80
setMethod · 0.45
getMethod · 0.45
addMethod · 0.45
has_keyMethod · 0.45

Tested by

no test coverage detected