def test_reset(self): b = Board() # First move some pieces around b.move(Square('e2'), Square('e4')) b.move(Square('e7'), Square('e5')) expected_piece = Piece( c.PieceType.pawn, c.Color.white, order=4, ) self.assertEqual( b.get_piece(Square('e4')), expected_piece, ) expected_piece = Piece( c.PieceType.pawn, c.Color.black, order=4, ) self.assertEqual( b.get_piece(Square('e5')), expected_piece, ) # Now let's reset the board b.reset() for square, piece in b.data.items(): if b.is_empty(square): continue expected_piece = self.data[square] self.assertEqual(piece, expected_piece)
def test_is_empty(self): b = Board() b.clear() for square, _ in self.data.items(): self.assertTrue(b.is_empty(square))