def test_clean(self): grid = Grid('... .#. ...'.split()) assert grid.is_infected((1, 1)) grid.clean((1, 1)) assert not grid.is_infected((1, 1))
def test_example_long(self): grid = Grid('..# #.. ...'.split()) virus = Virus(grid, (1, 1)) for _ in range(10000): virus._burst() assert virus._infect_count == 5587
def test_infect(self): grid = Grid('... .#. ...'.split()) assert not grid.is_infected((2, 2)) grid.infect((2, 2)) assert grid.is_infected((2, 2))
def test_is_current_node_is_infected(self): grid = Grid('... .#. ...'.split()) virus = Virus(grid, (1, 1)) assert virus._is_current_node_infected() virus = Virus(grid, (0, 0)) assert not virus._is_current_node_infected()