예제 #1
0
    def test_recovered_do_not_get_reinfected(self):
        self.two_in_contact[0].infected = True
        propagator = Propagator(self.two_in_contact, rate=1.0, infection_length=1)

        propagator.step_n(2)

        self.assertFalse(self.two_in_contact[0].infected)
예제 #2
0
    def test_results_days_are_consecutive_for_four_days(self):
        propagator = Propagator(self.two_in_contact)

        n_steps = 4
        propagator.step_n(n_steps)

        self.assertEqual([0, 1, 2, 3], propagator.results.day)
예제 #3
0
    def test_results_has_length_of_steps_with_three_steps(self):
        propagator = Propagator(self.two_in_contact)

        n_steps = 3
        propagator.step_n(n_steps)

        self.assertEqual(n_steps, len(propagator.results.day))
예제 #4
0
    def test_infected_given_infection_length_3_is_still_infected_after_2_steps(self):
        infected_person = Person()
        infected_person.infected = True
        propagator = Propagator([infected_person], infection_length=3)

        propagator.step_n(2)

        self.assertTrue(infected_person.infected)
예제 #5
0
    def test_infected_recover_after_infection_length_steps_of_2(self):
        infected_person = Person()
        infected_person.infected = True
        propagator = Propagator([infected_person], infection_length=2)

        propagator.step_n(2)

        self.assertFalse(infected_person.infected)
예제 #6
0
    def test_results_recovered_count_recovered(self):
        self.two_in_contact[0].infected = True

        propagator = Propagator(self.two_in_contact, infection_length=1, daily_mortality=0)

        propagator.step_n(2)

        self.assertEqual([0, 1], propagator.results.recovered_count)
예제 #7
0
    def test_results_dead_count_dead(self):
        self.two_in_contact[0].infected = True
        self.two_in_contact[1].dead = True

        propagator = Propagator(self.two_in_contact, infection_length=10, daily_mortality=1.0)

        propagator.step_n(2)

        self.assertEqual([1, 2], propagator.results.dead_count)
예제 #8
0
    def test_results_infected_count_infected(self):
        self.two_in_contact[0].infected = True
        self.two_in_contact[1].infected = True

        propagator = Propagator(self.two_in_contact, infection_length=1)

        propagator.step_n(2)

        self.assertEqual([2, 0], propagator.results.infected_count)