Пример #1
0
 def test_check_free_on_not_free_cell(self):
     board = Board()
     board.o(0, 2)
     self.assertFalse(board.is_free(0, 2))
Пример #2
0
 def test_full_completed(self):
     board = Board()
     for i in range(3):
         for j in range(3):
             board.o(i, j)
     self.assertTrue(board.completed)
Пример #3
0
 def test_check_free_on_free_cell(self):
     board = Board()
     board.o(0, 2)
     self.assertTrue(board.is_free(1, 2))
Пример #4
0
 def test_column_not_completed(self):
     board = Board()
     board.o(0, 2)
     board.o(1, 1)
     board.x(2, 0)
     self.assertFalse(board.completed)
Пример #5
0
 def test_cannot_override_same_value(self):
     board = Board()
     board.o(0, 2)
     self.assertRaises(AlreadySet, board.o, 0, 2)
Пример #6
0
 def test_diagonal2_completed_o_winner(self):
     board = Board()
     board.o(0, 2)
     board.o(1, 1)
     board.o(2, 0)
     self.assertEqual(CIRCLE, board.winner)
Пример #7
0
 def test_diagonal2_not_completed_no_winner(self):
     board = Board()
     board.o(0, 2)
     board.o(1, 1)
     board.x(2, 0)
     self.assertFalse(board.winner)
Пример #8
0
 def test_first_column_mixed_no_winner(self):
     board = Board()
     board.x(0, 0)
     board.x(1, 0)
     board.o(2, 0)
     self.assertFalse(board.winner)
Пример #9
0
 def test_first_column_completed_o_winner(self):
     board = Board()
     board.o(0, 0)
     board.o(1, 0)
     board.o(2, 0)
     self.assertEqual(CIRCLE, board.winner)
Пример #10
0
 def test_first_line_mixed_no_winner(self):
     board = Board()
     board.x(0, 0)
     board.x(0, 1)
     board.o(0, 2)
     self.assertFalse(board.winner)
Пример #11
0
 def test_clone_detaches_future_writes(self):
     board = Board()
     board2 = board.clone()
     board.o(0, 2)
     self.assertTrue(board2.is_free(0, 2))
Пример #12
0
 def test_clone_copies_already_set_cells(self):
     board = Board()
     board.o(0, 2)
     self.assertFalse(board.clone().is_free(0, 2))