예제 #1
0
 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)
예제 #2
0
 def test_OnFullBoardReturnsNoBoards(self):
     board = Board(['o', 'x', 'x', 'x', 'x', 'o', 'o', 'o', 'x'])
     result = board.next_boards()
     self.assertEqual(result, [])
예제 #3
0
 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))
예제 #4
0
 def test_OnEmptyBoardReturns9Boards(self):
     board = Board()
     result = board.next_boards()
     self.assertEqual(len(result), 9)
예제 #5
0
 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)
예제 #6
0
 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))
예제 #7
0
 def test_OnFullBoardReturnsNoBoards(self):
     board = Board(['o', 'x', 'x', 'x', 'x', 'o', 'o', 'o', 'x'])
     result = board.next_boards()
     self.assertEqual(result, [])
예제 #8
0
 def test_OnEmptyBoardReturns9Boards(self):
     board = Board()
     result = board.next_boards()
     self.assertEqual(len(result), 9)