diff --git a/fileformats/core/datatype.py b/fileformats/core/datatype.py index 3118948..530829c 100644 --- a/fileformats/core/datatype.py +++ b/fileformats/core/datatype.py @@ -263,7 +263,7 @@ def get_format(mime_name: str) -> ty.Type[DataType]: f"Did not find '{class_name}' class in fileformats.{namespace} " f"corresponding to MIME, or MIME-like, type {mime_string}" ) from None - if not issubclass(klass, cls): + if not (ty.get_origin(klass) is ty.Union or issubclass(klass, cls)): raise FormatRecognitionError( f"Class '{klass}' does not inherit from '{cls}'" )