示例#1
0
def test_cannot_position_tile_beyond_grid(position, x, y):
    from example import position_tile, Position, make_tile, make_grid
    grid = make_grid(5, 5)
    position = Position(*position)
    tile = make_tile('ship', position)
    grid = position_tile(grid, tile, position)
    assert grid[y][x] == tile
示例#2
0
def test_final_standings(five_grid):
    from example import Position, make_tile, position_tile, final_standings
    position = Position(2, 3)
    tile = make_tile('ship', position, direction=u'E')
    grid = position_tile(five_grid, tile, position)

    result = final_standings(grid)
    assert result == u'(2, 3, E)'
示例#3
0
def test_position_tile(five_grid):
    from example import position_tile, Position, make_tile
    position = Position(2, 3)
    tile = make_tile('ship', position)
    grid = position_tile(five_grid, tile, position)
    assert grid[1][2] == tile