earthlab / matplotcheck

A python package for checking and testing matplotlib plots. We use this for autograding student assignments but there are many other potential use cases including package testing (for packages with plots)!
https://matplotcheck.readthedocs.io
BSD 3-Clause "New" or "Revised" License
18 stars 8 forks source link

Change how assert_xydata() handles sets of data with different shape #233

Closed marty-larocque closed 4 years ago

marty-larocque commented 4 years ago

base.assert_xydata() uses np.testing.assert_array_max_ulp() to compare xy_data and xy_expected. When these two sets of data have the same shape but different data, assert_xydata() throws and AssertionError with a custom message.

However, when xy_data and xy_expected have different shapes, assert_array_max_ulp() throws a ValueError that is not caught. For our purposes, this is effectively a case in which xy_data and xy_expected do not match and should be handled the same way.

We should handle this case the same way and throw an AssertionError with a custom message.

marty-larocque commented 4 years ago

We decided to handle this case by throwing a ValueError, but still by throwing our own error with our own message. This is addressed in #219, and can be closed when that PR is merged.