def test_percent_completed_households(self):
     completion_rate = BatchCompletionRates(self.batch)
     self.batch.completed_households.create(householdmember=self.member_1)
     self.assertEqual(50, completion_rate.percent_completed_households(self.investigator_1.location,
                                                                       self.open_survey))
     self.batch.completed_households.create(householdmember=self.member_2)
     self.assertEqual(100, completion_rate.percent_completed_households(self.investigator_1.location,
                                                                        self.open_survey))
示例#2
0
 def test_percent_completed_households(self):
     completion_rate = BatchCompletionRates(self.batch)
     self.batch.completed_households.create(householdmember=self.member_1)
     self.assertEqual(
         50,
         completion_rate.percent_completed_households(
             self.investigator_1.location, self.open_survey))
     self.batch.completed_households.create(householdmember=self.member_2)
     self.assertEqual(
         100,
         completion_rate.percent_completed_households(
             self.investigator_1.location, self.open_survey))
 def test_calculate_percent(self):
     completion_rate = BatchCompletionRates(self.batch)
     self.assertEqual(40, completion_rate.calculate_percent(4, 10))
     self.assertEqual(80, completion_rate.calculate_percent(80, 100))
     self.assertEqual(20, completion_rate.calculate_percent(1, 5))
     self.assertEqual(12, completion_rate.calculate_percent(60, 500))
     self.assertEqual(0, completion_rate.calculate_percent(0, 0))
 def test_calculate_percent(self):
     completion_rate = BatchCompletionRates(self.batch)
     self.assertEqual(40, completion_rate.calculate_percent(4, 10))
     self.assertEqual(80, completion_rate.calculate_percent(80, 100))
     self.assertEqual(20, completion_rate.calculate_percent(1, 5))
     self.assertEqual(12, completion_rate.calculate_percent(60, 500))
     self.assertEqual(0, completion_rate.calculate_percent(4, 0))