Esempio n. 1
0
 def test01get_list(self):
     """calculed balance must be less than 1"""
     is_correct = True
     for (id, start, end, attempts_failed) in self.coh_struct_set :
         value = balance.getBalanceByAttempts (start, end, attempts_failed)
         if value > 1 :
             is_correct = False
             break
 
     self.assertEqual(is_correct, True)
Esempio n. 2
0
    def test02draw_and_choice(self):
        """random choice must return more than 80% elements"""
        cohs = {}
        for (id, start, end, attempts_failed) in self.coh_struct_set :
            value = balance.getBalanceByAttempts (start, end, attempts_failed)
            cohs[id] = value

        selected = balance.randomListByBalance(cohs, self.limit)
        is_correct = len(selected) / self.limit > 0.8

        self.assertEqual(is_correct, True)