Skip to content

Tidy error messages #1

@k2bd

Description

@k2bd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions