testing.assert_equal¶
- array_api_extra.testing.assert_equal(actual, desired, *, err_msg='', verbose=True, check_dtype=True, check_shape=True, check_scalar=False, xp=None)¶
Check that two arrays are equal.
This is an interface to
numpy.testing.assert_array_equal()which accepts any standard-compatible array and performs additional array namespace, shape, and dtype checks.- Parameters:
actual (Array) – The array produced by the tested function.
desired (Array) – The expected array (typically hardcoded).
err_msg (str, optional) – Error message to display on failure.
verbose (bool, default: True) – Whether to include the conflicting arrays in the error message on failure.
check_dtype (bool, default: True) – Whether to check agreement between actual and desired dtypes.
check_shape (bool, default: True) – Whether to check agreement between actual and desired shapes.
check_scalar (bool, default: False) – NumPy only: whether to check agreement between actual and desired types — 0-D
numpy.ndarrayvs scalar (e.g.numpy.double).xp (array_namespace, optional) – A standard-compatible namespace which actual and desired must match.
- Raises:
ImportError – If
numpyis not importable in the Python environment.- Return type:
See also
assert_closeSimilar function for inexact equality checks.
numpy.testing.assert_array_equalSimilar function for NumPy arrays.