-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi, thanks for this library!
First issue: runtype.issubclass disagrees with the built-in issubclass here:
>>> issubclass(collections.OrderedDict, dict)
True
>>> runtype.issubclass(collections.OrderedDict, dict)
FalseSecond issue: runtype.issubclass does not handle an OrderedDict with type parameters:
>>> issubclass(collections.OrderedDict[str, str], dict)
True
>>> runtype.issubclass(collections.OrderedDict[str, str], dict)
Traceback (most recent call last):
File "<bla>/site-packages/runtype/pytypes.py", line 637, in to_canon
return self.cache[t]
~~~~~~~~~~^^^
KeyError: collections.OrderedDict[str, str]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<bla>/site-packages/runtype/pytypes.py", line 640, in to_canon
res = _type_cast_mapping[t]
~~~~~~~~~~~~~~~~~~^^^
KeyError: collections.OrderedDict[str, str]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<bla>/site-packages/runtype/validation.py", line 65, in issubclass
return is_subtype(t1, t2)
^^^^^^^^^^^^^^^^^^
File "<bla>/site-packages/runtype/validation.py", line 23, in is_subtype
ct1 = type_caster.to_canon(t1)
^^^^^^^^^^^^^^^^^^^^^^^^
File "<bla>//site-packages/runtype/pytypes.py", line 642, in to_canon
res = self._to_canon(t)
^^^^^^^^^^^^^^^^^
File "<bla>/site-packages/runtype/pytypes.py", line 633, in _to_canon
raise NotImplementedError("No support for type:", t)
NotImplementedError: ('No support for type:', collections.OrderedDict[str, str])Environment: Python 3.12, runtype version 0.5.3
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working