>>> from typing_validation import validate, can_validate
>>> class MyClass: pass
...
>>> can_validate(type[MyClass])
The following type can be validated against:
type[
MyClass,
]
>>> validate(MyClass, type[MyClass])
True
>>> validate(10, Type[MyClass])
TypeError: Runtime validation error raised by validate(val, t), details below.
For type <class 'type'>, invalid value: 10
Unfortunately, the generic argument to type is not taken into consideration:
Some validation against
type
is supported:Unfortunately, the generic argument to
type
is not taken into consideration: