Skip to content

Commit a7bd44e

Browse files
committed
fix: ensure mother_type is a class before checking for ValueObject subclass
Signed-off-by: Adria Montoto <75563346+adriamontoto@users.noreply.github.com>
1 parent 01f30fb commit a7bd44e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

object_mother_pattern/models/base_mother.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def __init_subclass__(cls, **kwargs: Any) -> None:
6060
if not isclass(object=mother_type) and get_origin(tp=mother_type) is None:
6161
raise TypeError(f'BaseMother[...] <<<{mother_type}>>> must be a type. Got <<<{type(mother_type).__name__}>>> type.') # noqa: E501 # fmt: skip
6262

63-
if HAS_VALUE_OBJECTS and issubclass(mother_type, ValueObject):
64-
print('Detected ValueObject subclass as mother type.') # pragma: no cover
63+
if HAS_VALUE_OBJECTS and isclass(object=mother_type) and issubclass(mother_type, ValueObject):
6564
mother_type = mother_type.type()
6665

6766
cls._type = mother_type

0 commit comments

Comments
 (0)