diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a7850b..3f58736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## Pedantic 1.12.10 +- fix tests + ## Pedantic 1.12.9 - bugfix in type checking logic concerning `typing.Awaitable` and `typing.Coroutine` with return type `UnionType` diff --git a/docs/pedantic/type_checking_logic/check_types.html b/docs/pedantic/type_checking_logic/check_types.html index 41d7a6b..1ecdb45 100644 --- a/docs/pedantic/type_checking_logic/check_types.html +++ b/docs/pedantic/type_checking_logic/check_types.html @@ -584,10 +584,12 @@

Module pedantic.type_checking_logic.check_types bool: python_sub = _get_class_of_type_annotation(sub_type) python_super = _get_class_of_type_annotation(super_type) - if python_super == typing.Union or isinstance(python_super, types.UnionType): + is_union_type_available = hasattr(types, 'UnionType') # true for Python >= 3.10 + + if python_super == typing.Union or (is_union_type_available and isinstance(python_super, types.UnionType)): type_args = get_type_arguments(cls=super_type) - if python_sub == typing.Union or isinstance(python_sub, types.UnionType): + if python_sub == typing.Union or (is_union_type_available and isinstance(python_sub, types.UnionType)): sub_type_args = get_type_arguments(cls=sub_type) return all([x in type_args for x in sub_type_args]) diff --git a/setup.py b/setup.py index 317af73..4a2b206 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def get_content_from_readme(file_name: str = 'README.md') -> str: setup( name="pedantic", - version="1.12.9", + version="1.12.10", python_requires='>=3.7.0', packages=find_packages(), install_requires=[],