def test_board_no_state(): """makes default board""" board = """ ------------- | 1 | 2 | 3 | ------------- | 4 | 5 | 6 | ------------- | 7 | 8 | 9 | ------------- """.strip() assert format_board('.' * 9) == board
def test_board_with_state(): """makes board""" board = """ ------------- | 1 | 2 | 3 | ------------- | O | X | X | ------------- | 7 | 8 | 9 | ------------- """.strip() assert format_board('...OXX...') == board
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
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
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