def test_no_coaches_added_at_no_rate(self):
        population = [models.User() for u in range(100)]

        graph_generation.add_random_coaches(population, 0)

        self.assertEqual(
            max(len(u.learner_set) for u in population),
            0,
            msg="Found a coach unexpectedly"
        )
    def test_some_coaches_added_at_rate(self):
        n = 100
        rate = 0.1
        population = [models.User() for u in range(n)]

        graph_generation.add_random_coaches(population, rate)

        # There's a (1-rate)^n chance that there will be no coaches
        # So for n=100 and rate = 0.1. that's 1 in 35,000
        # Make sure there's at least 1 coach
        self.assertGreaterEqual(
            max(len(u.learner_set) for u in population),
            1,
            msg="No coaches were found"
        )