Trademark is a type of protection that prevents others from selling products similar to yours with your trademark.
So if a political party had a business selling T-shirts, sure it could trademark its name for the purposes of a clothes brand, and have protection there.
But could it trademark its name to prevent other political parties to have the same name? No, because political activity isn't a business activity.
Take note that owning a trademark doesn't prevent people from writing down your name or whatever. (In fact, defamation law doesn't apply to political parties, so you can say whatever you want about them.)