def test_neighbors_4_wrapped(): gr = Grid(TEST_GRID_RECT) n = sorted(gr.neighbors4(0, 3, wrap=True)) assert (n == [(0, 2), (0, 4), (1, 3), (3, 3)])
def test_neighbors_4_outside(): gr = Grid(TEST_GRID_IRREG, rectangular=False) n = sorted(gr.neighbors4(2, 5, outside=True)) assert (n == [(1, 5), (2, 4), (2, 6), (3, 5)])
def test_neighbors_4(): gr = Grid(TEST_GRID_IRREG, rectangular=False) n = sorted(gr.neighbors4(2, 5)) assert (n == [(1, 5), (2, 4)])