colour.utilities.xp_assert_close#

colour.utilities.xp_assert_close(actual: ArrayLike, desired: ArrayLike, *, rtol: float | None = None, atol: float | None = None, err_msg: str = '') None[source]#

Array API compatible implementation of numpy.testing.assert_allclose().

Both arrays are converted to NumPy via as_ndarray() before comparison.

Parameters:
  • actual (ArrayLike) – Array produced by the tested function.

  • desired (ArrayLike) – Expected array.

  • rtol (float | None) – Relative tolerance. If None, colour.constants.TOLERANCE_RELATIVE_TESTS, resolved at call time so that test fixtures relaxing the module-level constant also relax calls relying on the default.

  • atol (float | None) – Absolute tolerance. If None, colour.constants.TOLERANCE_ABSOLUTE_TESTS, resolved at call time so that test fixtures relaxing the module-level constant also relax calls relying on the default.

  • err_msg (str) – Error message to display on failure.

Return type:

None