def test_board2(self):
     ans = ['______W_',
            '_______B',
            '________',
            '________',
            '________',
            '________',
            '________',
            '________']
     self.assertEqual(ans, board((0, 6), (1, 7)))
 def test_board1(self):
     ans = ['________',
            '________',
            '___W____',
            '________',
            '________',
            '______B_',
            '________',
            '________']
     self.assertEqual(ans, board((2, 3), (5, 6)))
 def test_board2(self):
     ans = ['______W_',
            '_______B',
            '________',
            '________',
            '________',
            '________',
            '________',
            '________']
     self.assertEqual(board((0, 6), (1, 7)), ans)
 def test_board1(self):
     ans = ['________',
            '________',
            '___W____',
            '________',
            '________',
            '______B_',
            '________',
            '________']
     self.assertEqual(board((2, 3), (5, 6)), ans)
示例#5
0
 def test_board1(self):
     ans = [
         '00000000', '00000000', '000W0000', '00000000', '00000000',
         '000000B0', '00000000', '00000000'
     ]
     self.assertEqual(ans, board((2, 3), (5, 6)))
示例#6
0
 def test_queens_same_position_board(self):
     with self.assertRaises(ValueError):
         board((2, 2), (2, 2))
示例#7
0
 def test_invalid_position_board(self):
     with self.assertRaises(ValueError):
         board((0, 0), (7, 8))
示例#8
0
 def test_board2(self):
     ans = [
         '000000W0', '0000000B', '00000000', '00000000', '00000000',
         '00000000', '00000000', '00000000'
     ]
     self.assertEqual(ans, board((0, 6), (1, 7)))
示例#9
0
 def test_queen_invalid_column(self):
     with self.assertRaises(ValueError):
         board((1, 1), (4, 8))
示例#10
0
 def test_queen_negative_column(self):
     with self.assertRaises(ValueError):
         board((1, 1), (2, -2))
示例#11
0
 def test_queen_invalid_row(self):
     with self.assertRaises(ValueError):
         board((1, 1), (8, 4))
示例#12
0
 def test_queen_negative_row(self):
     with self.assertRaises(ValueError):
         board((1, 1), (-2, 2))
 def test_board1(self):
     ans = ['00000000', '00000000', '000W0000', '00000000',
            '00000000', '000000B0', '00000000', '00000000']
     self.assertEqual(ans, board((2, 3), (5, 6)))
 def test_board2(self):
     ans = ['000000W0', '0000000B', '00000000', '00000000',
            '00000000', '00000000', '00000000', '00000000']
     self.assertEqual(ans, board((0, 6), (1, 7)))
 def test_invalid_position_board(self):
     with self.assertRaises(ValueError):
         board((0, 0), (7, 8))
 def test_queens_same_position_board(self):
     with self.assertRaises(ValueError):
         board((2, 2), (2, 2))
示例#17
0
 def test_queen_valid_position(self):
     try:
         board((1, 1), (2, 2))
     except ValueError:
         self.fail("Unexpected Exception")