MCPcopy
hub / github.com/django/django / test_incr

Method test_incr

tests/cache/tests.py:407–421  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

405 self.assertIn("null", cache)
406
407 def test_incr(self):
408 # Cache values can be incremented
409 cache.set("answer", 41)
410 self.assertEqual(cache.incr("answer"), 42)
411 self.assertEqual(cache.get("answer"), 42)
412 self.assertEqual(cache.incr("answer", 10), 52)
413 self.assertEqual(cache.get("answer"), 52)
414 self.assertEqual(cache.incr("answer", -10), 42)
415 with self.assertRaises(ValueError):
416 cache.incr("does_not_exist")
417 with self.assertRaises(ValueError):
418 cache.incr("does_not_exist", -1)
419 cache.set("null", None)
420 with self.assertRaises(self.incr_decr_type_error):
421 cache.incr("null")
422
423 def test_decr(self):
424 # Cache values can be decremented

Callers

nothing calls this directly

Calls 3

setMethod · 0.45
incrMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected