tests.utils.assertions
Utility functions and constants for unit testing
Functions
- tests.utils.assertions.assert_allclose(actual, desired, rtol=1e-7, atol=0, equal_nan=True, err_msg='', verbose=True, name=None, fmt=printing.DEFAULT_FMT, dtype=np.float64)
Assert that all array elements correspond to the reference within the given tolerances
- Parameters:
actual (float | List[float] | List[list] | ndarray) – actual data
desired (float | List[float] | List[list] | ndarray) – reference data
rtol (float) – relative tolerance
atol (float) – absolute tolerance:
equal_nan (bool) – whether NaN values should be considered as equal
err_msg (str) – the error message to be printed in case of failure for dim >= 3 arrays
verbose (bool) – whether to print additional info
name (str) – name of the array (printed to help identifying the cause of the error in for loops)
fmt (str) – formatting for printing the values
dtype (dtype) – data type for conversion from list to ndarray