Ejemplo n.º 1
0
def test_select_expose_multiple_squares(game2):
    result = game2.select(0, 2)
    assert not game2.game_over
    assert ms.GameStatus.PLAYING == result.status
    assert 4 == len(result.new_squares)
    assert ms.Square(0, 2, 0) in result.new_squares
    assert ms.Square(0, 1, 1) in result.new_squares
    assert ms.Square(1, 1, 2) in result.new_squares
    assert ms.Square(1, 2, 1) in result.new_squares
Ejemplo n.º 2
0
def test_select_with_mine(game2):
    result = game2.select(1, 0)
    assert game2.game_over
    assert 1 == len(result.new_squares)
    assert ms.Square(1, 0, -1) in result.new_squares
Ejemplo n.º 3
0
def test_select_expose_only_selected_square(game2):
    result = game2.select(1, 1)
    assert not game2.game_over
    assert ms.GameStatus.PLAYING == result.status
    assert 1 == len(result.new_squares)
    assert ms.Square(1, 1, 2) in result.new_squares
Ejemplo n.º 4
0
def test_square_eq_with_wrong_type():
    assert ms.Square(1, 2, 3) != 72
Ejemplo n.º 5
0
def test_square_eq_with_no_match():
    assert ms.Square(5, 7, 3) != ms.Square(5, 8, 3)
    assert ms.Square(5, 7, 3) != ms.Square(4, 7, 3)
    assert ms.Square(5, 7, 3) != ms.Square(5, 7, 1)
Ejemplo n.º 6
0
def test_square_eq_with_match():
    assert ms.Square(0, 0, 0) == ms.Square(0, 0, 0)
    assert ms.Square(5, 7, 3) == ms.Square(5, 7, 3)