# xarray.testing.assert_equal

### xarray.testing.assert_equal(a, b, check_dim_order=True)[[source]](https://github.com/pydata/xarray/blob/main/xarray/testing/assertions.py#L121-L163)

Like [`numpy.testing.assert_array_equal()`](https://numpy.org/doc/stable/reference/generated/numpy.testing.assert_array_equal.html#numpy.testing.assert_array_equal), but for xarray
objects.

Raises an AssertionError if two objects are not equal. This will match
data values, dimensions and coordinates, but not names or attributes
(except for Dataset objects for which the variable names must match).
Arrays with NaN in the same location are considered equal.

For DataTree objects, assert_equal is mapped over all Datasets on each node,
with the DataTrees being equal if both are isomorphic and the corresponding
Datasets at each node are themselves equal.

* **Parameters:**
  * **a** ([`xarray.Dataset`](xarray.Dataset.html.md#xarray.Dataset), [`xarray.DataArray`](xarray.DataArray.html.md#xarray.DataArray), [`xarray.Variable`](xarray.Variable.html.md#xarray.Variable), [`xarray.Coordinates`](xarray.Coordinates.html.md#xarray.Coordinates)) – or xarray.core.datatree.DataTree. The first object to compare.
  * **b** ([`xarray.Dataset`](xarray.Dataset.html.md#xarray.Dataset), [`xarray.DataArray`](xarray.DataArray.html.md#xarray.DataArray), [`xarray.Variable`](xarray.Variable.html.md#xarray.Variable), [`xarray.Coordinates`](xarray.Coordinates.html.md#xarray.Coordinates)) – or xarray.core.datatree.DataTree. The second object to compare.
  * **check_dim_order** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *optional*, *default* `is True`) – Whether dimensions must be in the same order.

#### SEE ALSO
[`assert_identical`](xarray.testing.assert_identical.html.md#xarray.testing.assert_identical), [`assert_allclose`](xarray.testing.assert_allclose.html.md#xarray.testing.assert_allclose), `Dataset.equals`, `DataArray.equals`, [`numpy.testing.assert_array_equal`](https://numpy.org/doc/stable/reference/generated/numpy.testing.assert_array_equal.html#numpy.testing.assert_array_equal)
