How do I check (at runtime) if one class is a subclass of another?

Solution 1:

You can use issubclass() like this assert issubclass(suit, Suit).

Solution 2:

issubclass(class, classinfo)

Excerpt:

Return true if class is a subclass (direct, indirect or virtual) of classinfo.

Solution 3:

You can use isinstance if you have an instance, or issubclass if you have a class. Normally thought its a bad idea. Normally in Python you work out if an object is capable of something by attempting to do that thing to it.