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

PlotTester.assert_title_contains() will occasionally fail keywords with spaces #182

Closed nkorinek closed 4 years ago

nkorinek commented 4 years ago

PlotTester.assert_title_contains() will occasionally fail keywords with spaces. This was discovered on a plot where the output of plot_tester.get_title() was ('', 'HW Plot 1: Lidar Max vs. InSitu Max Tree Height\nSan Joaquin Field Site') and the failed keywords list was ["SJ", "SJER", "San Joaquin"]. If the space is taken out of "San Joaquin" to make it "SanJoaquin" the test passes. It could be that we just don't allow keywords with spaces, but that should be documented if that's the case. If we do decide to allow spaces, I believe it will be a rather easy fix. @lwasser

lwasser commented 4 years ago

thanks @nkorinek !!! great catch. we should definitely allow spaces. that's super quirky. Can you make a reproducible example with some fake data to demonstrate this in this issue please? i will make an issue template at some point too!!

nkorinek commented 4 years ago

@lwasser here's the reproducible example! It's pretty easy to replicate. https://gist.github.com/nkorinek/89ecd26db987fbd10e270bd6ee52e2f0

nkorinek commented 4 years ago

As shown in the gist, this is broken for assert_axis_label_contains as well.

nkorinek commented 4 years ago

hey @ryla5068 just FYI I've started working on this issue.

lwasser commented 4 years ago

@nkorinek does this issue relate to the pr i just merged? #205 i'd like to close issues that we've resolved!! there are a lot of issues here!

nkorinek commented 4 years ago

@lwasser it does!