Tests for Task 10: Vaccinate a city

This page describes the tests for Task 10. 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 10, run the following command at the Linux command-line:

$ py.test -xvk vaccinate_city

Test 0

Description: No one wants to be vaccinated except the infected person. No one gets vaxxed

To run this test in ipython3 :

city = [('S', 0, False),    # loc: 0
        ('S', 10, False),    # loc: 1
        ('S', 0, False),    # loc: 2
        ('S', 0, False),    # loc: 3
        ('S', 0, False),    # loc: 4
        ('I', 0, True),    # loc: 5
        ('S', 0, False)]    # loc: 6
sir.vaccinate_city(city)

Expected result:

[['S', 0],    # loc: 0
 ['S', 10],    # loc: 1
 ['S', 0],    # loc: 2
 ['S', 0],    # loc: 3
 ['S', 0],    # loc: 4
 ['I', 0],    # loc: 5
 ['S', 0]]    # loc: 6

Test 1

Description: Everyone is falling over themselves to get vaccinated. The susceptible people all get vaccinated.

To run this test in ipython3 :

city = [('S', 0, True),    # loc: 0
        ('S', 0, True),    # loc: 1
        ('S', 0, True),    # loc: 2
        ('S', 0, True),    # loc: 3
        ('S', 0, True),    # loc: 4
        ('I', 5, True),    # loc: 5
        ('S', 0, True)]    # loc: 6
sir.vaccinate_city(city)

Expected result:

[['V', 0],    # loc: 0
 ['V', 0],    # loc: 1
 ['V', 0],    # loc: 2
 ['V', 0],    # loc: 3
 ['V', 0],    # loc: 4
 ['I', 5],    # loc: 5
 ['V', 0]]    # loc: 6

Test 2

Description: Everyone wants to get vaccinated, but no one is eligible.

To run this test in ipython3 :

city = [('I', 0, True),    # loc: 0
        ('I', 1, True),    # loc: 1
        ('I', 2, True),    # loc: 2
        ('R', 0, True)]    # loc: 3
sir.vaccinate_city(city)

Expected result:

[['I', 0],    # loc: 0
 ['I', 1],    # loc: 1
 ['I', 2],    # loc: 2
 ['R', 0]]    # loc: 3

Test 3

Description: High level of interest. All but one susceptible person ends up vaccinated.

To run this test in ipython3 :

city = [('S', 0, True),    # loc: 0
        ('S', 0, True),    # loc: 1
        ('S', 0, True),    # loc: 2
        ('S', 0, True),    # loc: 3
        ('S', 0, False),    # loc: 4
        ('I', 0, False),    # loc: 5
        ('S', 0, True)]    # loc: 6
sir.vaccinate_city(city)

Expected result:

[['V', 0],    # loc: 0
 ['V', 0],    # loc: 1
 ['V', 0],    # loc: 2
 ['V', 0],    # loc: 3
 ['S', 0],    # loc: 4
 ['I', 0],    # loc: 5
 ['V', 0]]    # loc: 6

Test 4

Description: Citizens with different levels of interest in getting the vaccine.

To run this test in ipython3 :

city = [('S', 0, False),    # loc: 0
        ('S', 0, True),    # loc: 1
        ('S', 0, True),    # loc: 2
        ('S', 0, False),    # loc: 3
        ('S', 0, False),    # loc: 4
        ('I', 0, True),    # loc: 5
        ('S', 0, True)]    # loc: 6
sir.vaccinate_city(city)

Expected result:

[['S', 0],    # loc: 0
 ['V', 0],    # loc: 1
 ['V', 0],    # loc: 2
 ['S', 0],    # loc: 3
 ['S', 0],    # loc: 4
 ['I', 0],    # loc: 5
 ['V', 0]]    # loc: 6