You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
================================================================================================= FAILURES ==================================================================================================
________________________________________________________________________________________ TestRecursiveType.test_fail ________________________________________________________________________________________
/home/ben/src/forks/typeguard/tests/test_checkers.py:1411: in test_fail
check_type({"a": (1, 2, 3)}, JSONType)
/home/ben/src/forks/typeguard/src/typeguard/_functions.py:107: in check_type
check_type_internal(value, expected_type, memo)
/home/ben/src/forks/typeguard/src/typeguard/_checkers.py:946: in check_type_internal
checker(value, origin_type, args, memo)
/home/ben/src/forks/typeguard/src/typeguard/_checkers.py:427: in check_union
raise TypeCheckError(f"did not match any element in the union:\n{formatted_errors}")
E typeguard.TypeCheckError: dict did not match any element in the union:
E str: is not an instance of str
E float: is neither float or int
E bool: is not an instance of bool
E NoneType: is not an instance of NoneType
E List[annotationlib.JSONType]: is not a list
E Dict[str, annotationlib.JSONType]: value of key 'a' did not match any element in the union:
E str: is not an instance of str
E float: is neither float or int
E bool: is not an instance of bool
E NoneType: is not an instance of NoneType
E List[annotationlib.JSONType]: is not a list
E Dict[str, annotationlib.JSONType]: is not a dict
During handling of the above exception, another exception occurred:
/home/ben/src/forks/typeguard/tests/test_checkers.py:1392: in test_fail
with pytest.raises(
E AssertionError: Regex pattern did not match.
E Regex: "dict did not match any element in the union:\n str: is not an instance of str\n float: is neither float or int\n bool: is not an instance of bool\n NoneType: is not an instance of NoneType\n List\\[JSONType\\]: is not a list\n Dict\\[str, JSONType\\]: value of key 'a' did not match any element in the union:\n str: is not an instance of str\n float: is neither float or int\n bool: is not an instance of bool\n NoneType: is not an instance of NoneType\n List\\[JSONType\\]: is not a list\n Dict\\[str, JSONType\\]: is not a dict"
E Input: "dict did not match any element in the union:\n str: is not an instance of str\n float: is neither float or int\n bool: is not an instance of bool\n NoneType: is not an instance of NoneType\n List[annotationlib.JSONType]: is not a list\n Dict[str, annotationlib.JSONType]: value of key 'a' did not match any element in the union:\n str: is not an instance of str\n float: is neither float or int\n bool: is not an instance of bool\n NoneType: is not an instance of NoneType\n List[annotationlib.JSONType]: is not a list\n Dict[str, annotationlib.JSONType]: is not a dict"
____________________________________________________________________________________ test_typevar_forwardref[importhook] ____________________________________________________________________________________
/home/ben/src/forks/typeguard/tests/test_instrumentation.py:333: in test_typevar_forwardref
instance = dummymodule.typevar_forwardref(dummymodule.DummyClass)
/home/ben/src/forks/typeguard/tests/dummymodule.py:339: in typevar_forwardref
def typevar_forwardref(x: Type[T]) -> T:
/home/ben/src/forks/typeguard/src/typeguard/_functions.py:137: in check_argument_types
check_type_internal(value, annotation, memo)
/home/ben/src/forks/typeguard/src/typeguard/_checkers.py:946: in check_type_internal
checker(value, origin_type, args, memo)
/home/ben/src/forks/typeguard/src/typeguard/_checkers.py:481: in check_class
check_typevar(value, expected_class, (), memo, subclass_check=True)
/home/ben/src/forks/typeguard/src/typeguard/_checkers.py:538: in check_typevar
check_type_internal(value, annotation, memo)
/home/ben/src/forks/typeguard/src/typeguard/_checkers.py:946: in check_type_internal
checker(value, origin_type, args, memo)
/home/ben/src/forks/typeguard/src/typeguard/_checkers.py:504: in check_class
raise TypeCheckError(f"is not a subclass of {qualified_name(expected_class)}")
E typeguard.TypeCheckError: argument "x" (class dummymodule.DummyClass) is not a subclass of dummymodule.DummyClass
========================================================================================== short test summary info ==========================================================================================
FAILED tests/test_checkers.py::TestRecursiveType::test_fail - AssertionError: Regex pattern did not match.
FAILED tests/test_instrumentation.py::test_typevar_forwardref[importhook] - typeguard.TypeCheckError: argument "x" (class dummymodule.DummyClass) is not a subclass of dummymodule.DummyClass
============================================================================ 2 failed, 474 passed, 4 skipped, 9 xfailed in 1.39s ============================================================================
Without -W 'ignore::DeprecationWarning', I also see a lot of
E DeprecationWarning: ForwardRef._evaluate is a private API and is retained for compatibility, but will be removed in Python 3.16. Use ForwardRef.evaluate() or typing.evaluate_forward_ref() instead.
FAILED tests/test_checkers.py::TestRecursiveType::test_fail - AssertionError: Regex pattern did not match.
The output now has annotationlib.JSONType in place of just JSONType. I can fix this by adjusting the regex.
E DeprecationWarning: ForwardRef._evaluate is a private API and is retained for compatibility, but will be removed in Python 3.16. Use ForwardRef.evaluate() or typing.evaluate_forward_ref() instead.
FAILED tests/test_instrumentation.py::test_typevar_forwardref[importhook] - typeguard.TypeCheckError: argument "x" (class dummymodule.DummyClass) is not a subclass of dummymodule.DummyClass
Things to check first
I have searched the existing issues and didn't find my bug already reported there
I have checked that my bug is still present in the latest release
Typeguard version
Current
master
, b6a7e43Python version
3.14.0a1
What happened?
With
pytest -W 'ignore::DeprecationWarning'
:Without
-W 'ignore::DeprecationWarning'
, I also see a lot ofHow can we reproduce the bug?
The text was updated successfully, but these errors were encountered: