Testing#

testing.assert_equal(a, b[, check_dim_order])

Like numpy.testing.assert_array_equal(), but for xarray objects.

testing.assert_identical(a, b)

Like xarray.testing.assert_equal(), but also matches the objects' names and attributes.

testing.assert_allclose(a, b[, rtol, atol, ...])

Like numpy.testing.assert_allclose(), but for xarray objects.

testing.assert_chunks_equal(a, b)

Assert that chunksizes along chunked dimensions are equal.

Test that two DataTree objects are similar.

testing.assert_isomorphic(a, b)

Two DataTrees are considered isomorphic if the set of paths to their descendent nodes are the same.

testing.assert_equal(a, b[, check_dim_order])

Like numpy.testing.assert_array_equal(), but for xarray objects.

testing.assert_identical(a, b)

Like xarray.testing.assert_equal(), but also matches the objects' names and attributes.

Hypothesis Testing Strategies#

See the documentation page on testing for a guide on how to use these strategies.

Warning

These strategies should be considered highly experimental, and liable to change at any time.

testing.strategies.supported_dtypes()

Generates only those numpy dtypes which xarray can handle.

testing.strategies.names()

Generates arbitrary string names for dimensions / variables.

testing.strategies.dimension_names(*[, ...])

Generates an arbitrary list of valid dimension names.

testing.strategies.dimension_sizes(*[, ...])

Generates an arbitrary mapping from dimension names to lengths.

testing.strategies.attrs()

Generates arbitrary valid attributes dictionaries for xarray objects.

testing.strategies.variables(*[, ...])

Generates arbitrary xarray.Variable objects.

testing.strategies.unique_subset_of(objs, *)

Return a strategy which generates a unique subset of the given objects.