Details
-
Type:
Improvement
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: afw
-
Labels:None
-
Story Points:1
-
Epic Link:
-
Sprint:Science Pipelines DM-S15-5, Science Pipelines DM-S15-6
-
Team:Alert Production
Description
assertWcsNearlyEqualOverBBox and similar functions elsewhere in afw were written to be methods of lsst.utils.tests.TestCase, so their first argument is a testCase. This is fine for use in unit tests, but a hassle to use as free functions because the user must provide a testCase argument (though it need only be a trivial class with a fail(self, msgStr) method). Worse, that minimal requirement is not documented, so technically providing a simple mock test case is unsafe.
I have two proposals:
- Document the fact that testCase need only support fail(self, msgStr). This makes it clear how to safely use these functions as free functions.
- Allow testCase to be None, in which case RuntimeError is raised. That makes these functions even easier to use as free functions.
If the free function is really useful, I think I'd rather have a separate free function (that might return a boolean rather than raise) and a test-specific assert* function that uses it, rather than overloading too much into the parameters of the latter. We should keep all the assert* functions as similar as possible.