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

Add array equality helpers to TestCase

    Details

    • Type: Improvement
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: utils

      Description

      afw.math added equality helper method, e.g. assertImageEqual, that just call the appropriate NearlyEqual method with tolerance of 0. It would be good to have equivalent "assertArrayEqual" and "assertArrayNotEqual" methods that wrap assertClose, which has some useful functionality (e.g. plotting) beyond what numpy.testing.allClose provides.

        Attachments

          Issue Links

            Activity

            Hide
            Parejkoj John Parejko added a comment -

            Thank you for all the feedback. This has been merged to master and pushed. I'll announce on hipchat the changes, as those working on py.test updates will likely want them.

            Show
            Parejkoj John Parejko added a comment - Thank you for all the feedback. This has been merged to master and pushed. I'll announce on hipchat the changes, as those working on py.test updates will likely want them.
            Hide
            Parejkoj John Parejko added a comment - - edited

            Re-opening this as I've found a bug that has been apparently lurking for a long time: if you pass atol with rtol=None and the assert fails, the construction of the error message string raises TypeError! It's trying to divide by None! I'm creating some tests to exercise this and then fix it.

            Show
            Parejkoj John Parejko added a comment - - edited Re-opening this as I've found a bug that has been apparently lurking for a long time: if you pass atol with rtol=None and the assert fails, the construction of the error message string raises TypeError! It's trying to divide by None! I'm creating some tests to exercise this and then fix it.
            Hide
            Parejkoj John Parejko added a comment - - edited

            Russell: I've written tests that tickle the bug and fixed it. Please take a look at the new PR: https://github.com/lsst/utils/pull/19

            Show
            Parejkoj John Parejko added a comment - - edited Russell: I've written tests that tickle the bug and fixed it. Please take a look at the new PR: https://github.com/lsst/utils/pull/19
            Hide
            rowen Russell Owen added a comment -

            This looks great, though you might also want to test (scalar, array).

            Show
            rowen Russell Owen added a comment - This looks great, though you might also want to test (scalar, array).
            Hide
            Parejkoj John Parejko added a comment -

            Added the missing scalar/array cases. Thanks! Pushed and merged.

            Show
            Parejkoj John Parejko added a comment - Added the missing scalar/array cases. Thanks! Pushed and merged.

              People

              • Assignee:
                Parejkoj John Parejko
                Reporter:
                Parejkoj John Parejko
                Reviewers:
                Russell Owen
                Watchers:
                Ian Sullivan, Jim Bosch, John Parejko, Paul Price, Pim Schellart [X] (Inactive), Russell Owen, Simon Krughoff, Tim Jenness
              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: