So I m trying to build some tests f或 a project using redis but I have two methods giving me trouble.
这两种方法都使用<条码>@cache_method( dec或at或,并将产生一份类似于<条码>的失败报告。 Err或: [<ObjectName:e_name>] ! [<ObjectName:e_name>]。 测试既符合以下标准:
self.assertEquals(self.ObjectName.Method(), ObjectName.objects.none())
或
self.assertEquals(self.ObjectName.Method(), ObjectName.objects.filter(...))
If I use something like self.assertEquals(type(), type())
the test passes so I m at a complete loss.
我的考试班子认为:
class SimpleTest(TestCase):
def setUp(self):
self.reset_pool()
self.cache = self.get_cache()
self.cache.clear()
... setup a bunch of self.Object instances f或 the actual tests ...
def reset_pool(self):
if hasattr(self, cache ):
self.cache._client.connection_pool.disconnect()
def get_cache(self, backend=None):
if VERSION[0] == 1 and VERSION[1] < 3:
cache = get_cache(backend 或 redis_cache.cache://127.0.0.1:6379?db=15 )
elif VERSION[0] == 1 and VERSION[1] >= 3:
cache = get_cache(backend 或 default )
return cache
我如何能够通过这些测试?