示例#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})
示例#2
0
 def goal_count(self, alternative, goal):
     return counters.get(GOAL_KEY % (self.name, alternative, goal))
示例#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))
示例#6
0
 def test_delete_key(self):
     counters.increment(TEST_KEY, 'fred')
     counters.reset(TEST_KEY)
     self.assertEqual(counters.get(TEST_KEY), 0)
示例#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)
示例#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)
示例#9
0
 def setUp(self):
     counters.reset(TEST_KEY)
     self.assertEqual(counters.get(TEST_KEY), 0)
示例#10
0
 def test_delete_key(self):
     counters.increment(TEST_KEY, 'fred')
     counters.reset(TEST_KEY)
     self.assertEqual(counters.get(TEST_KEY), 0)
示例#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)
示例#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)
示例#13
0
 def setUp(self):
     counters.reset(TEST_KEY)
     self.assertEqual(counters.get(TEST_KEY), 0)