def test_random_strategy(self): self.metric_cache.store('foo', (123456, 1.0)) self.metric_cache.store('bar', (123457, 2.0)) self.metric_cache.store('baz', (123458, 3.0)) strategy = RandomStrategy(self.metric_cache) for _i in range(3): item = strategy.choose_item() self.assertTrue(item in self.metric_cache) self.metric_cache.pop(item)