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

Add array equality helpers to TestCase

    XMLWordPrintable

Details

    • Improvement
    • Status: Done
    • Resolution: Done
    • None
    • 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

            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.

            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.
            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.

            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.
            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

            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
            rowen Russell Owen added a comment -

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

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

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

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

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Jenkins

                  No builds found.