-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST/CLN: centralize common validation methods in test_graphics #7036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@TomAugspurger @cpcloud pls review |
def setUp(self): | ||
TestPlotBase.setUp(self) | ||
import matplotlib as mpl | ||
self.mpl_le_1_2_1 = str(mpl.__version__) <= LooseVersion('1.2.1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these need to be somewhere else; if mpl cannot be imported this will fail
maybe in the mplskip decorator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks OK because test classes are decorated by @tm.mplskip
.
One general comment. Anywhere that you have a pattern like for result, expected in zip(ax.lines, expected_lines):
assertEqual(result, expected) could you add a test at the start or end to ensure that the two things being zipped have the same length? I don't think we have any generators here, so this should be doable. For example, this would pass
since zip only zips up to the shortest. |
""" | ||
axes = self._flatten_visible(axes) | ||
for ax in axes: | ||
ytick = ax.get_yticklabels()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this could fail if we have a plot with no ticks (I'm not sure that we do). You may want to check for this or add an argument to check either the yticks
, xticks
, or both
(default). I could see a case where we remove one axis' ticklabels but still want to use this test.
@TomAugspurger Thanks, I've modified except last point. Could you check? |
TST/CLN: centralize common validation methods in test_graphics
Thanks for this. Good work! |
Create base class for plotting related test, and organized data creation and validation function.