from django.test import TestCase

from .models import Foo

class CachedGetTest(TestCase):
    def test_cached_get(self):
        first_object = Foo.objects.create(bar='bees')

        # Populate the cache
        Foo.get_cached(first_object.pk)

        # Get from the cache
        cached_object = Foo.get_cached(first_object.pk)

        self.assertEqual(first_object.bar, cached_object.bar)

@@ -95,23 +95,13 @@
 def 
-test_cached_get
+setUp
 (sel
@@ -112,28 +112,24 @@
         
-first_object
+self.foo
  = Foo.o
@@ -154,25 +154,24 @@
 'bees')%0A
-%0A
         
 # Popula
@@ -166,78 +166,139 @@
     
-# Populate the cache%0A        Foo.get_cached(first_object.pk)%0A%0A 
+self._populate_cache()%0A%0A    def _populate_cache(self):%0A        Foo.get_cached(self.foo.pk)%0A%0A    def test_cached_get(self):%0A
        
+ 
 # Ge
@@ -357,84 +357,415 @@
 hed(
-first_object.pk)%0A%0A        self.assertEqual(first_object.bar, cached_object.bar
+self.foo.pk)%0A%0A        self.assertEqual(self.foo.bar, cached_object.bar)%0A%0A    def test_cache_invalidated_on_update(self):%0A        self.foo.bar = 'quux'%0A        self.foo.save()%0A%0A        self._populate_cache()%0A%0A        self.assertEqual(Foo.get_cached(self.foo.pk).bar, 'quux')%0A%0A    def test_cache_invalidated_on_delete(self):%0A        self.foo.bar = 'quux'%0A        self.foo.delete()%0A%0A        self._populate_cache(
 )%0A

Add cache invalidation tests