MCPcopy
hub / github.com/django/django / test_long_timeout

Method test_long_timeout

tests/cache/tests.py:626–642  ·  view source on GitHub ↗

Follow memcached's convention where a timeout greater than 30 days is treated as an absolute expiration timestamp instead of a relative offset (#12399).

(self)

Source from the content-addressed store, hash-verified

624 self.assertIsNone(cache.get("key2"))
625
626 def test_long_timeout(self):
627 """
628 Follow memcached's convention where a timeout greater than 30 days is
629 treated as an absolute expiration timestamp instead of a relative
630 offset (#12399).
631 """
632 cache.set("key1", "eggs", 60 * 60 * 24 * 30 + 1) # 30 days + 1 second
633 self.assertEqual(cache.get("key1"), "eggs")
634
635 self.assertIs(cache.add("key2", "ham", 60 * 60 * 24 * 30 + 1), True)
636 self.assertEqual(cache.get("key2"), "ham")
637
638 cache.set_many(
639 {"key3": "sausage", "key4": "lobster bisque"}, 60 * 60 * 24 * 30 + 1
640 )
641 self.assertEqual(cache.get("key3"), "sausage")
642 self.assertEqual(cache.get("key4"), "lobster bisque")
643
644 @retry()
645 def test_forever_timeout(self):

Callers

nothing calls this directly

Calls 4

setMethod · 0.45
getMethod · 0.45
addMethod · 0.45
set_manyMethod · 0.45

Tested by

no test coverage detected