Tests for Task 7: Vaccinate a person

This page describes the tests for Task 7. For each task, we provide a short description of the test, information about how to recreate the test in ipython3, and the expected result.

To run the tasks for Task 7, run the following command at the Linux command-line:

$ py.test -xvk 'vaccinate_person'

Test 0

Purpose: Infected person w/ zero days in that state

To run this test in ipython3 :

random.seed(20170217)
vaccinate_person(('I', 0, 1.0))

Expected result: ('I', 0)

Test 1

Purpose: Infected person w/ non-zero number of days in that state

To run this test in ipython3 :

random.seed(20170217)
vaccinate_person(('I', 10, 1.0))

Expected result: ('I', 10)

Test 2

Purpose: Recovered person w/ zero days in that state

To run this test in ipython3 :

random.seed(20170217)
vaccinate_person(('R', 0, 1.0))

Expected result: ('R', 0)

Test 3

Purpose: Recovered person w/ non-zero number of days in that state

To run this test in ipython3 :

random.seed(20170217)
vaccinate_person(('R', 10, 1.0))

Expected result: ('R', 10)

Test 4

Purpose: Susceptible person w/ 100% eagerness to be vaccinated

To run this test in ipython3 :

random.seed(20170217)
vaccinate_person(('S', 10, 1.0))

Expected result: ('V', 0)

Test 5

Purpose: Susceptible person w/ 0% eagerness to be vaccinated

To run this test in ipython3 :

random.seed(20170217)
vaccinate_person(('S', 10, 0.0))

Expected result: ('S', 10)

Test 6

Purpose: Susceptible person w/ 80% eagerness to be vaccinated, which is above the value that will be generated by the call to random.random()

To run this test in ipython3 :

random.seed(20170217)
vaccinate_person(('S', 10, 0.8))

Expected result: ('V', 0)

Test 7

Purpose: Susceptible person w/ 40% eagerness to be vaccinated, which is below the value that will be generated by the call to random.random()

To run this test in ipython3 :

random.seed(20170217)
vaccinate_person(('S', 10, 0.4))

Expected result: ('S', 10)