E.g. validation with a Traits Enum:
@enforce_type_hints
def example_function(a: Enum(1, 5, "c", 4.0)):
pass
example_function(7)
The 'a' parameter of 'example_function' must be <traits.trait_types.Enum object at 0x10e6e54a8>, but a value of 7 <class 'int'> was specified.
E.g. validation with a Traits array:
def example_function(b: Array(dtype="float64", shape=(2, None))):
pass
example_function(np.array([[1, 2], [3, 4], [5, 6]], dtype="float64"))
The 'b' parameter of 'example_function' must be <traits.trait_numeric.Array object at 0x11730e240>, but a value of array([[1., 2.],
[3., 4.],
[5., 6.]]) <class 'numpy.ndarray'> was specified.
E.g. validation with a Traits Enum:
E.g. validation with a Traits array: