def runTest(self): magnolia, created = Movie(title="Magnolia").save() # instance is in the db section of the store, because it was saved self.assert_(magnolia in store._cache._instances.values()) # it is not in the dirty section of the store self.assert_(magnolia not in store._dirty.values()) # it can be found by a query self.assert_(magnolia is Movie.objects.get(title="Magnolia")) self.assert_(magnolia not in store._dirty.values()) # now call delete on it magnolia.delete() # check raw values from database self.assert_(Movie.objects.filter(title="Magnolia").as_dict() == {}) # it is not in the database store anymore self.assert_(magnolia not in store._cache._instances.values()) # it is also removed from the dirty store self.assert_(magnolia not in store._dirty.values()) # it can't be found via query self.assertRaises(DoesNotExist, Movie.objects.get, **{"title": "Magnolia"})