def test_clear_value(self): counters.increment(TEST_KEY, 'fred') counters.increment(TEST_KEY, 'fred') counters.increment(TEST_KEY, 'fred') counters.increment(TEST_KEY, 'barney') counters.increment(TEST_KEY, 'barney') counters.clear(TEST_KEY, 'fred') self.assertEqual(counters.get(TEST_KEY), 1) self.assertEqual(counters.get_frequencies(TEST_KEY), {2: 1})
def goal_count(self, alternative, goal): return counters.get(GOAL_KEY % (self.name, alternative, goal))
def participant_count(self, alternative): return counters.get(PARTICIPANT_KEY % (self.name, alternative))
def test_delete_key(self): counters.increment(TEST_KEY, 'fred') counters.reset(TEST_KEY) self.assertEqual(counters.get(TEST_KEY), 0)
def test_add_duplicate_item(self): counters.increment(TEST_KEY, 'fred') counters.increment(TEST_KEY, 'fred') counters.increment(TEST_KEY, 'fred') self.assertEqual(counters.get(TEST_KEY), 1)
def test_add_multiple_items(self): counters.increment(TEST_KEY, 'fred') counters.increment(TEST_KEY, 'barney') counters.increment(TEST_KEY, 'george') counters.increment(TEST_KEY, 'george') self.assertEqual(counters.get(TEST_KEY), 3)
def setUp(self): counters.reset(TEST_KEY) self.assertEqual(counters.get(TEST_KEY), 0)