def test_get(self):
#mock the pick and set it to the data variable
test_pickle = pickle.dumps(
{pickle.dumps(self.test_key): self.test_value}, protocol=2)
self.test_cache.data = pickle.loads(test_pickle)
#assert
self.assertEquals(self.test_cache.get(self.test_key), self.test_value)
self.assertEquals(self.test_cache.get(self.bad_key), None)
评论列表
文章目录