Ejemplo n.º 1
0
def test_illegal_column_2():
    """
    Correct error when move has invalid column number (2)
    """
    game = connectz.Game(7, 6, 4)
    with pytest.raises(AssertionError, match="illegal column"):
        game.make_move(8)
Ejemplo n.º 2
0
def test_legal_moves():
    """
    Correct boardstate for sequence of moves
    """
    game = connectz.Game(7, 6, 4)
    for move in [1, 1, 2]:
        game.make_move(move)
    assert game.board == fixtures.EXPECTED_LEGAL_MOVE_BOARD
Ejemplo n.º 3
0
def test_illegal_row():
    """
    Correct error when row is overfilled
    """
    game = connectz.Game(7, 6, 4)
    with pytest.raises(AssertionError, match="illegal row"):
        for _ in range(8):
            game.make_move(1)
Ejemplo n.º 4
0
def test_board_shape():
    """
    Builds correct board shape when initialized
    """
    game = connectz.Game(rows=10, columns=2, win_length=3)
    assert game.board == fixtures.TEN_BY_TWO_BOARD