=================================== FAILURES ===================================
__________________ TestClsFunction.test_complex_cls_function ___________________
self = <tests.classes.test_cls_function.TestClsFunction testMethod=test_complex_cls_function>
def test_complex_cls_function(self):
# Test if a more complex ClsFunction can be created without problems.
_Size = Union[int, Literal[Any]]
_Type = Union[type, Literal[Any]]
ClsFunction({
_Size: lambda: 1,
_Type: lambda: 2,
Tuple[_Size, _Type]: lambda: 3,
Tuple[_Size, ...]: lambda: 4,
Tuple[Tuple[_Size, ...], _Type]: lambda: 5,
Tuple[Tuple[_Size, EllipsisType], _Type]: lambda: 6,
Tuple[Tuple[Literal[Any], EllipsisType], Literal[Any]]: lambda: 7,
})
tests/classes/test_cls_function.py:128:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
typish/classes/_cls_function.py:24: in __init__
self.body = ClsDict(body)
^^^^^^^^^^^^^
typish/classes/_cls_dict.py:25: in __new__
if not all([is_type_annotation(key) for key in args[0]]):
^^^^^^^^^^^^^^^^^^^^^^^
typish/functions/_is_type_annotation.py:22: in is_type_annotation
or instance_of(item, super_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
typish/functions/_instance_of.py:18: in instance_of
return all(_instance_of(obj, clsinfo, state) for clsinfo in args)
^^^
typish/functions/_instance_of.py:18: in <genexpr>
return all(_instance_of(obj, clsinfo, state) for clsinfo in args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
typish/functions/_instance_of.py:35: in _instance_of
return subclass_of(type_, clsinfo)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
typish/functions/_subclass_of.py:19: in subclass_of
return all(_subclass_of(cls, clsinfo) for clsinfo in args)
^^^
typish/functions/_subclass_of.py:19: in <genexpr>
return all(_subclass_of(cls, clsinfo) for clsinfo in args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
typish/functions/_subclass_of.py:36: in _subclass_of
result = _forward_subclass_check(cls, clsinfo)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
typish/functions/_subclass_of.py:54: in _forward_subclass_check
cls_args = get_args(cls)
^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
t = <class 'typing.Union'>
def get_args(t: type) -> typing.Tuple[type, ...]:
"""
Get the arguments from a collection type (e.g. ``typing.List[int]``) as a
``tuple``.
:param t: the collection type.
:return: a ``tuple`` containing types.
"""
args_ = getattr(t, '__args__', tuple()) or tuple()
args = tuple([attr for attr in args_
^^^^^
if type(attr) != typing.TypeVar])
E TypeError: 'member_descriptor' object is not iterable
typish/functions/_get_args.py:12: TypeError
=========================== short test summary info ============================
FAILED tests/classes/test_cls_function.py::TestClsFunction::test_complex_cls_function
======================== 1 failed, 121 passed in 0.25s =========================