def test_bishop_isvalid(self): '''Bishop move validation''' testdata = {Bishop('white'): [(2, 0), (0, 2), True], Bishop('white'): [(2, 0), (1, 2), False], } for piece, (start, end, ans) in testdata.items(): result = piece.isvalid(start, end) self.assertEqual(result, ans)
def testBishopClass(self): # test moves array self.assertEqual(Bishop.moves, [[1, 1], [1, -1], [-1, 1], [-1, -1]]) b = Bishop() l = [found_position for found_position in b.possible_positions("D4")] self.assertEqual(l, [ 'E5', 'F6', 'G7', 'H8', 'E3', 'F2', 'G1', 'C5', 'B6', 'A7', 'C3', 'B2', 'A1' ])