Ejemplo n.º 1
0
def test_has_neighbors_false():
    test_board = BattleshipBoard(name='test')
    test_board.board = [
        [' ', ' ', ' '],
        [' ', ' ', ' '],
        [' ', ' ', ' '],
    ]

    assert test_board.has_neighbors(x=1, y=1) is False
Ejemplo n.º 2
0
def test_has_neighbors_true_21():
    test_board = BattleshipBoard(name='test')
    test_board.board = [
        [' ', ' ', ' '],
        [' ', ' ', ' '],
        [' ', '=', ' '],
    ]

    assert test_board.has_neighbors(x=1, y=1) is True
Ejemplo n.º 3
0
def test_set_ship():
    patch('main.random.randint', side_effect=0)
    test_board = BattleshipBoard(name='test', height=3, width=3)
    # test_board.board = [
    #     [' ', ' ', ' '],
    #     [' ', ' ', ' '],
    #     [' ', ' ', ' '],
    # ]

    founded = test_board._get_space(ship_size=3, x=1, y=1)
    print(founded)