コード例 #1
0
def test_remove_from_rectangle():
    board = Rectangle(2, 3)
    assert set(board.squares) == set([(0, 0), (1, 0), (0, 1), (1, 1), (0, 2),
                                      (1, 2)])
    trimmed = board.remove((1, 1))
    assert set(trimmed.squares) == set([(0, 0), (1, 0), (0, 1), (0, 2),
                                        (1, 2)])
コード例 #2
0
def test_error_if_removing_not_present():
    board = Rectangle(2, 3)
    assert set(board.squares) == set([(0, 0), (1, 0), (0, 1), (1, 1), (0, 2),
                                      (1, 2)])
    with pytest.raises(Exception):
        board.remove((2, 4))