mirror of
https://github.com/django-components/django-components.git
synced 2025-08-31 03:07:19 +00:00
refactor: fix error when template cache is set to 0 (#980)
This commit is contained in:
parent
58d4c78671
commit
fdfdc72ed2
3 changed files with 31 additions and 0 deletions
|
@ -43,6 +43,27 @@ class CacheTests(TestCase):
|
|||
self.assertEqual(cache.get("e"), None)
|
||||
self.assertEqual(cache.get("f"), None)
|
||||
|
||||
def test_cache_maxsize_zero(self):
|
||||
cache = LRUCache[int](maxsize=0)
|
||||
|
||||
cache.set("a", 1)
|
||||
self.assertEqual(cache.get("a"), None)
|
||||
|
||||
cache.set("b", 2)
|
||||
cache.set("c", 3)
|
||||
self.assertEqual(cache.get("b"), None)
|
||||
self.assertEqual(cache.get("c"), None)
|
||||
|
||||
# Same with negative numbers
|
||||
cache = LRUCache[int](maxsize=-1)
|
||||
cache.set("a", 1)
|
||||
self.assertEqual(cache.get("a"), None)
|
||||
|
||||
cache.set("b", 2)
|
||||
cache.set("c", 3)
|
||||
self.assertEqual(cache.get("b"), None)
|
||||
self.assertEqual(cache.get("c"), None)
|
||||
|
||||
|
||||
class ComponentMediaCacheTests(TestCase):
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue