Exemplo n.º 1
0
    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})
Exemplo n.º 2
0
 def goal_count(self, alternative, goal):
     return counters.get(GOAL_KEY % (self.name, alternative, goal))
Exemplo n.º 3
0
 def participant_count(self, alternative):
     return counters.get(PARTICIPANT_KEY % (self.name, alternative))
 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))
Exemplo n.º 6
0
 def test_delete_key(self):
     counters.increment(TEST_KEY, 'fred')
     counters.reset(TEST_KEY)
     self.assertEqual(counters.get(TEST_KEY), 0)
Exemplo n.º 7
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)
Exemplo n.º 8
0
 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)
Exemplo n.º 9
0
 def setUp(self):
     counters.reset(TEST_KEY)
     self.assertEqual(counters.get(TEST_KEY), 0)
Exemplo n.º 10
0
 def test_delete_key(self):
     counters.increment(TEST_KEY, 'fred')
     counters.reset(TEST_KEY)
     self.assertEqual(counters.get(TEST_KEY), 0)
Exemplo n.º 11
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)
Exemplo n.º 12
0
 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)
Exemplo n.º 13
0
 def setUp(self):
     counters.reset(TEST_KEY)
     self.assertEqual(counters.get(TEST_KEY), 0)