def setUp(self): self.board = chessboard.ChessBoard() self.board[18] = pieces.QueenPiece('white') self.board[19] = pieces.PawnPiece('white') self.board[23] = pieces.RookPiece('black') self.board[42] = pieces.KnightPiece('black') self.generator = movegenerator._CoreMoveGenerator(self.board)
def test_equality(self): piece2 = pieces.KnightPiece('black') self.assertEqual( self.piece, piece2, errormessage( "%s =/= %s" % (self.piece, "KnightPiece"), "%s == %s" % (self.piece, "KnightPiece") ) ) return None
def test__setitem__badposition(self): piece = pieces.KnightPiece('black') with self.assertRaises(TypeError): # String input self.board['string'] = piece with self.assertRaises(TypeError): # Float input self.board[10.5] = piece with self.assertRaises(TypeError): # Too many elements self.board[[1, 4, 5]] = piece with self.assertRaises(TypeError): # Too few elements self.board[(1, )] = piece with self.assertRaises(IndexError): # Off the board. self.board[91] = piece return None
def setUp(self): self.piece = pieces.KnightPiece('white') return None