def test_get_multiple_percentiles(self): date = dateutil.parser.parse('2015-08-01') trimester = main.get_trimester(date) session = models.Session() session.completed_time = date session.model_based = self.model_session1 list_percentiles = [] for i in range(0, 10): list_percentiles.append(models_tests.generate_percentile( pk=i, seed=5, type=i * 2, course=i * 3, trimester=trimester )) self.percentiles = list_percentiles activity1 = models.Activity() activity1.sort = 10 activity1.words_minute = 10 activity2 = models.Activity() activity2.sort = 20 activity2.words_minute = 19 session.list_activities = [ activity2, activity1 ] self.assertIsNone(main.get_percentile(self.mock_older, session)) session.model_based = self.model_session2 self.assertIsNone(main.get_percentile(self.mock_older, session)) self.get_filtered_times_value = (0,19) self.mock_older.group.course.id = 6 r = main.get_percentile(self.mock_older, session) self.assertEqual(self.get_filtered_times_last_session, session) self.assertIsNotNone(r) self.assertEqual(r, 20)
def test_get_not_valid(self): session1 = models.Session() session1.completed_time = dateutil.parser.parse('2015-08-01') session1.model_based = self.model_session1 self.percentiles = [] self.assertIsNone(main.get_percentile(self.mock_older, session1))