def test_normal_random_population_creation(self): # XXX: I suppose it's possible these asserts could fail because we're dealing with # probabalistic outcomes; I haven't taken the time to prove these always work p = Population() p.randomize(1024) self.assertLess(len(p.coaches), len(p.students)) self.assertLess(len(p.studying_coaches), len(p.coaches)) self.assertLess(1, max([len(u.coaches()) for u in p.students]))
def test_pessimistic_random_population_creation(self): p = Population() # 10 students who are all infected, all teachers, and all study p.randomize(10, infect_rate=1, feature='A', coach_rate=1, coach_study_rate=1) self.assertEqual(10, p.N) self.assertEqual(p.N, len(p.population)) self.assertEqual(len(p.population), len(p.infected)) self.assertEqual(len(p.infected), len(p.students)) self.assertEqual(len(p.students), len(p.coaches))