示例#1
0
def test_dead_cell_with_2_neighbours_keep_dead():
    cell = Cell(Cell.DEAD)
    live_neighbours = 2

    cell.evolve(live_neighbours)

    assert cell.status == Cell.DEAD
示例#2
0
def test_dead_cell_with_3_neighbours_change_to_live():
    cell = Cell(Cell.DEAD)
    live_neighbours = 3

    cell.evolve(live_neighbours)

    assert cell.status == Cell.ALIVE
示例#3
0
def test_alive_cell_with_fewer_fewer_2_neighbours_dies():
    cell = Cell(Cell.ALIVE)
    live_neighbours = 1

    cell.evolve(live_neighbours)

    assert cell.status == Cell.DEAD
示例#4
0
def test_alive_cell_with_3_neighbours_keep_alive():
    cell = Cell(Cell.ALIVE)
    live_neighbours = 3

    cell.evolve(live_neighbours)

    assert cell.status == Cell.ALIVE
示例#5
0
def test_alive_cell_with_more_than_3_neighbours_dies():
    cell = Cell(Cell.ALIVE)
    live_neighbours = 4

    cell.evolve(live_neighbours)

    assert cell.status == Cell.DEAD