fixed type error

This commit is contained in:
Tim Rid 2022-02-13 16:59:01 +01:00
parent 8169f0ed31
commit 9a9b4ab95a
2 changed files with 3 additions and 3 deletions

View file

@ -118,8 +118,8 @@ class DataclassConstruct(Adapter[t.Any, t.Any, T, T]):
dc_type: t.Type[T],
reverse: bool = False,
) -> None:
if not isinstance(dc_type, DataclassStruct):
raise TypeError(f"'{repr(dc_type)}' has to be a 'DataclassStruct'")
if not issubclass(dc_type, DataclassStruct):
raise TypeError(f"'{repr(dc_type)}' has to be a subclass of 'DataclassStruct'")
if not dataclasses.is_dataclass(dc_type):
raise TypeError(f"'{repr(dc_type)}' has to be a 'dataclasses.dataclass'")
self.dc_type = dc_type

View file

@ -6,7 +6,7 @@ import typing as t
import construct as cs
import construct_typed as cst
from construct_typed import DataclassBitStruct, DataclassMixin, DataclassStruct, csfield
from construct_typed import DataclassBitStruct, DataclassStruct, csfield
from .declarativeunittest import common, raises, setattrs