Skip to content

Conversation

@astrofrog
Copy link
Collaborator

Before:

        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]]], dtype=int16)
actualImage = array([[[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
     ...[255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]]], dtype=int16)

    def calculate_rms(expectedImage, actualImage):
        "Calculate the per-pixel errors, then compute the root mean square error."
        if expectedImage.shape != actualImage.shape:
            raise ImageComparisonFailure(
                "Image sizes do not match expected size: {} "
>               "actual size {}".format(expectedImage.shape, actualImage.shape))
E           matplotlib.testing.exceptions.ImageComparisonFailure: Image sizes do not match expected size: (153, 177, 3) actual size (146, 170, 3)

/usr/local/lib/python3.5/dist-packages/matplotlib/testing/compare.py:356: ImageComparisonFailure

After:

Error: Image dimensions did not match.
  Expected shape: (800, 600)
    /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmp9p8eizmu/baseline-test_succeeds.png
  Actual shape: (900, 900)
    /var/folders/zy/t1l3sx310d3d6p0kyxqzlrnr0000gr/T/tmp9p8eizmu/test_succeeds.png

The most important is that the file paths are now included.

Arguably this better error should be in compare_images but that would break the current behavior of raising an exception when the shapes don't match. Also, by adding it here it will work with all versions of Matplotlib.

@astrofrog
Copy link
Collaborator Author

The CI passed, even though the results didn't get reported back here.

@astrofrog astrofrog merged commit 13e8c5e into matplotlib:master Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant