Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-3347

assertWcsNearlyEqualOverBBox and friends is too hard to use as a free function

    Details

    • Type: Improvement
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: afw
    • Labels:
      None
    • Templates:
    • Story Points:
      1
    • 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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rowen Russell Owen
                Reporter:
                rowen Russell Owen
                Reviewers:
                Kian-Tat Lim
                Watchers:
                Kian-Tat Lim, Russell Owen, Scott Daniel, Tim Jenness
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel