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 (
object) – The array produced by the tested function.desired (
object) – The expected array (typically hardcoded).err_msg (
str) – Error message to display on failure.verbose (
bool) – Whether to include the conflicting arrays in the error message on failure.check_dtype (
bool) – Whether to check agreement between actual and desired dtypes.check_shape (
bool) – Whether to check agreement between actual and desired shapes.check_scalar (
bool) – NumPy only: whether to check agreement between actual and desired types — 0-Dnumpy.ndarrayvs scalar (e.g.numpy.double).xp (
ModuleType|None) – A standard-compatible namespace which actual and desired must match.
- Raises:
AssertionError – If actual and desired are not equal.
ImportError – If
numpyis not importable in the Python environment.
See also
assert_closeSimilar function for inexact equality checks.
numpy.testing.assert_array_equalSimilar function for NumPy arrays.
- Return type: