This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / _external / array_api_extra / testing / assert_equal

function

scipy._external.array_api_extra.testing:assert_equal

source: build-install/usr/lib/python3.14/site-packages/scipy/_external/array_api_extra/testing.py:827

Signature

def assert_equal(actual: Array, desired: Array, *, err_msg: str = '', verbose: bool = True, check_dtype: bool = True, check_shape: bool = True, check_scalar: bool = False, check_device: bool = True, xp: ArrayNamespace | None = None) → None

Summary

Check that two arrays are equal.

Extended Summary

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.ndarray vs scalar (e.g. numpy.double).

check_device : bool, default: True

Whether to check agreement between actual and desired devices.

xp : array_namespace, optional

A standard-compatible namespace which actual and desired must match.

Raises

: AssertionError

If actual and desired are not equal.

: ImportError

If numpy is not importable in the Python environment.

See also

assert_close

Similar function for inexact equality checks.

numpy.testing.assert_array_equal

Similar function for NumPy arrays.

Aliases

  • scipy.differentiate.xpx.testing.assert_equal