Exemplo n.º 1
0
 def increment_goal_count(self,
                          alternative_name,
                          goal_name,
                          participant_identifier,
                          count=1):
     # Increment experiment_name:alternative:participant counter
     counter_key = GOAL_KEY % (self.name, alternative_name, goal_name)
     counters.increment(counter_key, participant_identifier, count)
Exemplo n.º 2
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.º 3
0
 def increment_participant_count(self, alternative_name,
                                 participant_identifier):
     # Increment experiment_name:alternative:participant counter
     counter_key = PARTICIPANT_KEY % (self.name, alternative_name)
     counters.increment(counter_key, participant_identifier)
 def increment_goal_count(self, alternative_name, goal_name, participant_identifier, count=1):
     # Increment experiment_name:alternative:participant counter
     counter_key = GOAL_KEY % (self.name, alternative_name, goal_name)
     counters.increment(counter_key, participant_identifier, count)
 def increment_participant_count(self, alternative_name, participant_identifier):
     # Increment experiment_name:alternative:participant counter
     counter_key = PARTICIPANT_KEY % (self.name, alternative_name)
     counters.increment(counter_key, participant_identifier)
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_get_frequencies(self):
     counters.increment(TEST_KEY, 'fred')
     counters.increment(TEST_KEY, 'barney')
     counters.increment(TEST_KEY, 'george')
     counters.increment(TEST_KEY, 'roger')
     counters.increment(TEST_KEY, 'roger')
     counters.increment(TEST_KEY, 'roger')
     counters.increment(TEST_KEY, 'roger')
     self.assertEqual(counters.get_frequencies(TEST_KEY), {1: 3, 4: 1})
Exemplo n.º 8
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.º 9
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.º 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_get_frequencies(self):
     counters.increment(TEST_KEY, 'fred')
     counters.increment(TEST_KEY, 'barney')
     counters.increment(TEST_KEY, 'george')
     counters.increment(TEST_KEY, 'roger')
     counters.increment(TEST_KEY, 'roger')
     counters.increment(TEST_KEY, 'roger')
     counters.increment(TEST_KEY, 'roger')
     self.assertEqual(counters.get_frequencies(TEST_KEY), {1: 3, 4: 1})
Exemplo n.º 12
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.º 13
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)