コード例 #1
0
 def test_get_adjacent_corner(self):
     board = Board()
     player_one = "X"
     player_two = "O"
     moves_one = ["B1", "B2", "B3"]
     moves_two = ["A1", "A2", "A3"]
     for move in moves_one:
         board.make_move(move, player_one)
     for move in moves_two:
         board.make_move(move, player_two)
     adjacent = board.get_adjacent("A1")
     expected_adjacent = [player_one, player_two]
     self.assertCountEqual(expected_adjacent, adjacent,
                           "Should contain one X token, one O token.")
コード例 #2
0
 def test_get_adjacent_middle(self):
     board = Board()
     player_one = "X"
     player_two = "O"
     moves_one = ["B1", "B2", "B3"]
     moves_two = ["A1", "A2", "A3"]
     for move in moves_one:
         board.make_move(move, player_one)
     for move in moves_two:
         board.make_move(move, player_two)
     adjacent = board.get_adjacent("B2")
     expected_adjacent = [
         player_one, player_two, player_one, ttt_config['empty']
     ]
     self.assertCountEqual(
         expected_adjacent, adjacent,
         "Should contain two X tokens, one O, one Free Space")