def test_max_scores_cache(self): """ Tests the behavior fo the MaxScoresCache """ max_scores_cache = MaxScoresCache("test_max_scores_cache") self.assertEqual(max_scores_cache.num_cached_from_remote(), 0) self.assertEqual(max_scores_cache.num_cached_updates(), 0) # add score to cache max_scores_cache.set(self.locations[0], 1) self.assertEqual(max_scores_cache.num_cached_updates(), 1) # push to remote cache max_scores_cache.push_to_remote() # create a new cache with the same params, fetch from remote cache max_scores_cache = MaxScoresCache("test_max_scores_cache") max_scores_cache.fetch_from_remote(self.locations) # see cache is populated self.assertEqual(max_scores_cache.num_cached_from_remote(), 1)