numpy.testing.print_assert_equal#

testing.print_assert_equal(test_string, actual, desired)[source]#

Test if two objects are equal, and print an error message if test fails.

The test is performed with actual == desired.

Parameters:
test_stringstr

The message supplied to AssertionError.

actualobject

The object to test for equality against desired.

desiredobject

The expected result.

Examples

>>> np.testing.print_assert_equal('Test XYZ of func xyz', [0, 1], [0, 1])
>>> np.testing.print_assert_equal('Test XYZ of func xyz', [0, 1], [0, 2])
Traceback (most recent call last):
...
AssertionError: Test XYZ of func xyz failed
ACTUAL:
[0, 1]
DESIRED:
[0, 2]