Beispiel #1
0
def test_cell_init_at_origin_no_above_and_below_neighbors():
    location = [0, 0]
    cell = Cell(location, True)
    neighbors_expected = [[0, 1], [1, 1], [1, 0]]

    neighbors = cell.get_neighbors()
    assert neighbors == neighbors_expected
Beispiel #2
0
def test_cell_neighbor_locations_correct():
    #There are a max of 8 neighbors for any one cell on a grid
    location = [2, 3]
    cell = Cell(location, True)

    neighbors_row_above = helper_get_above_neigbors(location)
    neighbors_row_on = helper_get_on_neighbors(location)
    neighbors_row_below = helper_get_below_neigbors(location)
    neighbors_expected = neighbors_row_above
    neighbors_expected.extend(neighbors_row_on)
    neighbors_expected.extend(neighbors_row_below)
    neighbor_locations = cell.get_neighbors()

    assert neighbors_expected == neighbor_locations