yt.testing.
assert_allclose
(actual, desired, rtol=1e-07, atol=0, err_msg='', verbose=True)[source]¶Raises an AssertionError if two objects are not equal up to desired tolerance.
The test is equivalent to allclose(actual, desired, rtol, atol)
.
It compares the difference between actual and desired to
atol + rtol * abs(desired)
.
New in version 1.5.0.
Parameters: | actual : array_like
desired : array_like
rtol : float, optional
atol : float, optional
err_msg : str, optional
verbose : bool, optional
|
---|---|
Raises: | AssertionError :
|
See also
assert_array_almost_equal_nulp
, assert_array_max_ulp
Examples
>>> x = [1e-5, 1e-3, 1e-1]
>>> y = np.arccos(np.cos(x))
>>> assert_allclose(x, y, rtol=1e-5, atol=0)