-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove many unused variables in tests. #13957
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
lib/matplotlib/tests/test_axes.py
Outdated
ax = plt.subplot(4, 1, 4) | ||
plt.hist(data_big, 100, histtype='stepfilled', log=True, | ||
orientation='horizontal') | ||
fig, axs = plt.subplots(4) |
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.
This puts an unused variable in?
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.
true, fixed
lib/matplotlib/tests/test_axes.py
Outdated
ax.set_title('aardvark') | ||
ax.set_title('left', loc='left') | ||
ax.set_title('right', loc='right') | ||
|
||
assert 'left' == ax.get_title(loc='left') | ||
assert 'right' == ax.get_title(loc='right') | ||
assert 'aardvark' == ax.get_title(loc='center') |
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.
Probably should keep both versions of this.
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.
oops, that was removed by mistake. restored.
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.
Minor concerns about touching the test suite in general, but looks ok.
I think some of those plt.figure
calls were defensive from figure leaking between tests, but knowing when that isolation fails also seems useful.
26890ea
to
2b3f5c5
Compare
lib/matplotlib/tests/test_mlab.py
Outdated
@@ -1835,7 +1828,7 @@ def test_specgram_angle(self): | |||
pad_to=self.pad_to_specgram, | |||
sides=self.sides, | |||
mode='angle') | |||
specm = np.mean(spec, axis=1) | |||
np.mean(spec, axis=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.
That's doing nothing. specs
is not modified and the return value is not used.
lib/matplotlib/tests/test_mlab.py
Outdated
@@ -1851,7 +1844,7 @@ def test_specgram_phase(self): | |||
pad_to=self.pad_to_specgram, | |||
sides=self.sides, | |||
mode='phase') | |||
specm = np.mean(spec, axis=1) | |||
np.mean(spec, axis=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.
Doing nothing.
lib/matplotlib/tests/test_scale.py
Outdated
@@ -100,11 +100,11 @@ def test_logscale_transform_repr(): | |||
# check that repr of log transform succeeds | |||
fig, ax = plt.subplots() | |||
ax.set_yscale('log') | |||
s = repr(ax.transData) | |||
repr(ax.transData) |
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.
Does nothing`? Or
repr(ax.transData) | |
repr(ax.transData) # smoke test that repr() succededs |
... as detected by enabling F841 in flake8. A lot of these are instantiations of figures which are not used because the test then uses the pyplot interface anyways; the figure doesn't need to be explicitly instantiated as tests always run with no preexisting figure (via an autouse fixture).
thanks, comments handled |
... as detected by enabling F841 in flake8.
A lot of these are instantiations of figures which are not used because
the test then uses the pyplot interface anyways; the figure doesn't need
to be explicitly instantiated as tests always run with no preexisting
figure (via an autouse fixture).
Split out from #13932 for reviewability.
PR Summary
PR Checklist