|
LSSTApplications
8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
|
Classes | |
| class | MemoryTestCase |
| class | temporaryFile |
| class | TestCase |
Functions | |
| def | init |
| def | run |
| def | findFileFromRoot |
| def | inTestCase |
| def | assertRaisesLsstCpp |
| def | debugger |
| def | plotImageDiff |
| def | assertClose |
| def | assertNotClose |
Variables | |
| dafBase = None | |
| int | memId0 = 0 |
| int | nleakPrintMax = 20 |
| def lsst.utils.tests.assertClose | ( | testCase, | |
| lhs, | |||
| rhs, | |||
rtol = sys.float_info.epsilon, |
|||
atol = sys.float_info.epsilon, |
|||
relTo = None, |
|||
printFailures = True, |
|||
plotOnFailure = False, |
|||
plotFileName = None, |
|||
invert = False |
|||
| ) |
Highly-configurable floating point comparisons for scalars and arrays.
The test assertion will fail if all elements lhs and rhs are not equal to within the tolerances
specified by rtol and atol. More precisely, the comparison is:
abs(lhs - rhs) <= relTo*rtol OR abs(lhs - rhs) <= atol
If rtol or atol is None, that term in the comparison is not performed at all.
When not specified, relTo is the elementwise maximum of the absolute values of lhs and rhs. If
set manually, it should usually be set to either lhs or rhs, or a scalar value typical of what
is expected.
@param[in] testCase unittest.TestCase instance the test is part of
@param[in] lhs LHS value(s) to compare; may be a scalar or a numpy array of any dimension
@param[in] rhs RHS value(s) to compare; may be a scalar or a numpy array of any dimension
@param[in] rtol Relative tolerance for comparison; defaults to double-precision epsilon.
@param[in] atol Absolute tolerance for comparison; defaults to double-precision epsilon.
@param[in] relTo Value to which comparison with rtol is relative.
@param[in] printFailures Upon failure, print all inequal elements as part of the message.
@param[in] plotOnFailure Upon failure, plot the originals and their residual with matplotlib.
Only 2-d arrays are supported.
@param[in] plotFileName Filename to save the plot to. If None, the plot will be displayed in a
a window.
@param[in] invert If True, invert the comparison and fail only if any elements *are* equal.
Used to implement assertNotClose, which should generally be used instead
for clarity.
Definition at line 245 of file tests.py.
| def lsst.utils.tests.assertNotClose | ( | testCase, | |
| lhs, | |||
| rhs, | |||
| kwds | |||
| ) |
| def lsst.utils.tests.assertRaisesLsstCpp | ( | testcase, | |
| excClass, | |||
| callableObj, | |||
| args, | |||
| kwargs | |||
| ) |
| def lsst.utils.tests.debugger | ( | exceptions | ) |
Decorator to enter the debugger when there's an uncaught exception To use, just slap a "@debugger()" on your function. You may provide specific exception classes to catch as arguments to the decorator function, e.g., "@debugger(RuntimeError, NotImplementedError)". This defaults to just 'AssertionError', for use on unittest.TestCase methods. Code provided by "Rosh Oxymoron" on StackOverflow: http://stackoverflow.com/questions/4398967/python-unit-testing-automatically-running-the-debugger-when-a-test-fails
| def lsst.utils.tests.findFileFromRoot | ( | ifile | ) |
| def lsst.utils.tests.inTestCase | ( | func | ) |
| def lsst.utils.tests.plotImageDiff | ( | lhs, | |
| rhs, | |||
bad = None, |
|||
diff = None, |
|||
plotFileName = None |
|||
| ) |
Plot the comparison of two 2-d NumPy arrays.
NOTE: this method uses matplotlib and imports it internally; it should be
wrapped in a try/except block within packages that do not depend on
matplotlib (including utils).
@param[in] lhs LHS values to compare; a 2-d NumPy array
@param[in] rhs RHS values to compare; a 2-d NumPy array
@param[in] bad A 2-d boolean NumPy array of values to emphasize in the plots
@param[in] plotFileName Filename to save the plot to. If None, the plot will be displayed in a
a window.
Definition at line 190 of file tests.py.
| def lsst.utils.tests.run | ( | suite, | |
exit = True |
|||
| ) |
1.8.5