import unittest

from queen_attack import board, can_attack


class QueenAttackTest(unittest.TestCase):
    def test_board1(self):
        ans = ['________',
               '________',
               '___W____',
               '________',
               '________',
               '______B_',
               '________',
               '________']
        self.assertEqual(board((2, 3), (5, 6)), ans)

    def test_board2(self):
        ans = ['______W_',
               '_______B',
               '________',
               '________',
               '________',
               '________',
               '________',
               '________']
        self.assertEqual(board((0, 6), (1, 7)), ans)

    def test_attack_true1(self):
        self.assertTrue(can_attack((2, 3), (5, 6)))

    def test_attack_true2(self):
        self.assertTrue(can_attack((2, 6), (5, 3)))

    def test_attack_true3(self):
        self.assertTrue(can_attack((2, 4), (2, 7)))

    def test_attack_true4(self):
        self.assertTrue(can_attack((5, 4), (2, 4)))

    def test_attack_true5(self):
        self.assertTrue(can_attack((1, 1), (6, 6)))

    def test_attack_true6(self):
        self.assertTrue(can_attack((0, 6), (1, 7)))

    def test_attack_false1(self):
        self.assertFalse(can_attack((4, 2), (0, 5)))

    def test_attack_false2(self):
        self.assertFalse(can_attack((2, 3), (4, 7)))

    # If either board or can_attack are called with an invalid board position
    # they should raise a ValueError with a meaningful error message.
    def test_invalid_position_board(self):
        with self.assertRaises(ValueError):
            board((0, 0), (7, 8))

    def test_invalid_position_can_attack(self):
        with self.assertRaises(ValueError):
            can_attack((0, 0), (7, 8))

    def test_queens_same_position_board(self):
        with self.assertRaises(ValueError):
            board((2, 2), (2, 2))

    def test_queens_same_position_can_attack(self):
        with self.assertRaises(ValueError):
            can_attack((2, 2), (2, 2))


if __name__ == '__main__':
    unittest.main()

@@ -735,36 +735,34 @@
      self.assert
-True
+Is
 (can_attack((2, 
@@ -768,24 +768,30 @@
  3), (5, 6))
+, True
 )%0A%0A    def t
@@ -825,36 +825,34 @@
      self.assert
-True
+Is
 (can_attack((2, 
@@ -862,16 +862,22 @@
  (5, 3))
+, True
 )%0A%0A    d
@@ -915,36 +915,34 @@
      self.assert
-True
+Is
 (can_attack((2, 
@@ -948,24 +948,30 @@
  4), (2, 7))
+, True
 )%0A%0A    def t
@@ -1005,36 +1005,34 @@
      self.assert
-True
+Is
 (can_attack((5, 
@@ -1042,16 +1042,22 @@
  (2, 4))
+, True
 )%0A%0A    d
@@ -1095,36 +1095,34 @@
      self.assert
-True
+Is
 (can_attack((1, 
@@ -1132,16 +1132,22 @@
  (6, 6))
+, True
 )%0A%0A    d
@@ -1193,20 +1193,18 @@
 f.assert
-True
+Is
 (can_att
@@ -1218,24 +1218,30 @@
  6), (1, 7))
+, True
 )%0A%0A    def t
@@ -1276,37 +1276,34 @@
      self.assert
-False
+Is
 (can_attack((4, 
@@ -1313,16 +1313,23 @@
  (0, 5))
+, False
 )%0A%0A    d
@@ -1376,21 +1376,18 @@
 f.assert
-False
+Is
 (can_att
@@ -1405,16 +1405,23 @@
  (4, 7))
+, False
 )%0A%0A    #

replace assertFalse with assertIs