testing
Numerical tests with controllable strictness.
The key difference to numpy.testing is the global switch TEST_ACTION
that determines whether the tests raise AssertionErrors or issue
ComparisonWarnings. For speed-critical applications, they may
also be turned off altogether.
- temfpy.testing.TEST_ACTION: str = 'warn'
Determines how the testing functions in this module (and elsewhere in TeMFpy) behave.
Allowed values:
"raise": raise anAssertionError"warn": issue aComparisonWarning(default)"pass": don’t test at all
The behaviour of the tests reacts dynamically to changing
TEST_ACTION:from temfpy import testing testing.assert_allclose(1, 2) # prints a warning testing.TEST_ACTION = "raise" testing.assert_allclose(1, 2) # raises an exception testing.TEST_ACTION = "pass" testing.assert_allclose(1, 2) # nothing happens
Testing functions
Indicates if the two objects are not equal up to desired tolerance. |
|
Indicates if the first object is not elementwise smaller than the second. |
|
Checks if the given Schmidt modes and correlation matrix are consistent. |
|
Generic warning class for failed equality testing or comparison. |
- temfpy.testing.assert_allclose(actual, desired, rtol=1e-07, atol=0.0, equal_nan=True, err_msg='', verbose=False, *, strict=False)[source]
Indicates if the two objects are not equal up to desired tolerance.
See
assert_allclose()for details of the calling sequence.- Raises:
AssertionError | ComparisonWarning – If the shapes of the two arrays don’t match or any two entries deviate by more than the given tolerance.
- temfpy.testing.assert_array_less(x, y, err_msg='', verbose=False, *, strict=False)[source]
Indicates if the first object is not elementwise smaller than the second.
See
assert_array_less()for details of the calling sequence.- Raises:
AssertionError | ComparisonWarning – If the shapes of the two arrays don’t match or any entry of
xis not less than the corresponding entry ofy.
- temfpy.testing.check_schmidt_decomposition(modes, C, diag_tol=1e-08)[source]
Checks if the given Schmidt modes and correlation matrix are consistent.
- Parameters:
- Raises:
AssertionError | ComparisonWarning – If any entry of the correlation matrix deviates from its reconstruction from
modesby more thandiag_tol.