コード例 #1
0
ファイル: unit.py プロジェクト: wFanhua/tiny_python_projects
def test_board_no_state():
    """makes default board"""

    board = """
-------------
| 1 | 2 | 3 |
-------------
| 4 | 5 | 6 |
-------------
| 7 | 8 | 9 |
-------------
""".strip()

    assert format_board('.' * 9) == board
コード例 #2
0
ファイル: unit.py プロジェクト: wFanhua/tiny_python_projects
def test_board_with_state():
    """makes board"""

    board = """
-------------
| 1 | 2 | 3 |
-------------
| O | X | X |
-------------
| 7 | 8 | 9 |
-------------
""".strip()

    assert format_board('...OXX...') == board
コード例 #3
0
ファイル: test.py プロジェクト: bilbatez/tiny_python_projects
def test_format_board_with_fully_assigned():
    """test format_board with all cells assigned"""
    board = list("XXOOXXOOX")
    actual = format_board(board)
    expected = """
-------------
| X | X | O |
-------------
| O | X | X |
-------------
| O | O | X |
-------------
""".lstrip()
    assert expected == actual
コード例 #4
0
ファイル: test.py プロジェクト: bilbatez/tiny_python_projects
def test_format_board_with_empty_values():
    """test format_board with empty board"""
    board = ["."] * 9
    actual = format_board(board)
    expected = """
-------------
| 1 | 2 | 3 |
-------------
| 4 | 5 | 6 |
-------------
| 7 | 8 | 9 |
-------------
""".lstrip()
    assert expected == actual
コード例 #5
0
ファイル: test.py プロジェクト: bilbatez/tiny_python_projects
def test_format_board_with_partially_assigned():
    """test format_board with some cells assigned"""
    board = list("XX..OO..O")
    actual = format_board(board)
    expected = """
-------------
| X | X | 3 |
-------------
| 4 | O | O |
-------------
| 7 | 8 | O |
-------------
""".lstrip()
    assert expected == actual