Skip to content

Commit ab5aab0

Browse files
committed
isoftype: raise NotImplementedError when fail to understand type
1 parent 713da53 commit ab5aab0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

unpythonic/typecheck.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,15 @@ def iscollection(statictype, runtimetype):
364364
# Catch any `typing` meta-utilities we don't currently support.
365365
if hasattr(T, "__module__") and T.__module__ == "typing": # pragma: no cover, only happens when something goes wrong.
366366
fullname = repr(T.__class__)
367-
raise NotImplementedError("This run-time type checker doesn't currently support '{}'".format(fullname))
367+
raise NotImplementedError("This run-time type checker doesn't currently support {}".format(repr(fullname)))
368368

369369
try:
370370
return isinstance(value, T) # T should be a concrete class, so delegate.
371371
except TypeError as err: # pragma: no cover, for debugging when things go wrong
372-
raise TypeError("Failed to understand the type, so here's some debug data: {}, {}, {}, {}".format(type(T),
373-
repr(T.__class__),
374-
str(T),
375-
repr(T))) from err
372+
raise NotImplementedError("Failed to understand the type, so here's some debug data: {}, {}, {}, {}".format(type(T),
373+
repr(T.__class__),
374+
str(T),
375+
repr(T))) from err
376376

377377
# TODO: Add an `issubtype` function. It's needed to fully resolve callable types in `isoftype`.
378378
#

0 commit comments

Comments
 (0)