Skip to content

Assertion error messages aren't very useful #563

@db434

Description

@db434

Compare numpy's error messages:

>>> numpy.testing.assert_allclose([1, 2], [1, 3])
AssertionError:
Not equal to tolerance rtol=1e-07, atol=0

Mismatched elements: 1 / 2 (50%)
Max absolute difference: 1
Max relative difference: 0.33333333
 x: array([1, 2])
 y: array([1, 3])

With unyt's:

>>> unyt.testing.assert_allclose_units([1, 2] * unyt.m, [1, 3] * unyt.m)
AssertionError

Is there any appetite for aligning these better, to expose more information when something goes wrong? I'm happy to contribute here - we have something like this internally already.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions