def test_DoesNotMutateBoard(self): board = Board(['o', 1, 2, 3, 'x', 5, 6, 7, 8]) board.next_boards() new_board = Board(['o', 1, 2, 3, 'x', 5, 6, 7, 8]) self.assertEqual(board, new_board)
def test_OnFullBoardReturnsNoBoards(self): board = Board(['o', 'x', 'x', 'x', 'x', 'o', 'o', 'o', 'x']) result = board.next_boards() self.assertEqual(result, [])
def test_OnBoardWithTwoOptionsReturnsListOfBothResultingBoards(self): board = Board([0, 1, 'x', 'o', 'x', 'o', 'x', 'o', 'x']) result = board.next_boards() expected1 = Board(['o', 1, 'x', 'o', 'x', 'o', 'x', 'o', 'x']) expected2 = Board([0, 'o', 'x', 'o', 'x', 'o', 'x', 'o', 'x']) self.assertEqual(sorted([expected1, expected2]), sorted(result))
def test_OnEmptyBoardReturns9Boards(self): board = Board() result = board.next_boards() self.assertEqual(len(result), 9)