Skip to content

CLN: Check Warnings in test_graphics_others #13188

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

Merged

Conversation

TomAugspurger
Copy link
Contributor

Also a MatplotlibDeprecationWarning for use of .get_axes() vs. .axes in some tests.

@TomAugspurger TomAugspurger added Testing pandas testing functions or related to the test suite Visualization plotting labels May 15, 2016
@TomAugspurger TomAugspurger added this to the 0.18.2 milestone May 15, 2016
@TomAugspurger
Copy link
Contributor Author

@neirbowj I don't know if this will fix your failing test or not, could you give it a shot? I think we have some assertions in here that depends on the test execution order :/

@neirbowj
Copy link
Contributor

@TomAugspurger Yes, the tests are now passing. Thank you.

@jreback
Copy link
Contributor

jreback commented May 22, 2016

@TomAugspurger can you rebase this and see if you can fix the error?

@TomAugspurger
Copy link
Contributor Author

Been trying to figure it out, but I can't get the error locally :/ I'll ping you when I get it sorted out.

@jorisvandenbossche
Copy link
Member

@TomAugspurger ping :-)

@TomAugspurger TomAugspurger force-pushed the cleanup-testgraphicsother branch from f6d36f5 to 7e68600 Compare June 24, 2016 14:11
@codecov-io
Copy link

codecov-io commented Jun 24, 2016

Current coverage is 84.33%

Merging #13188 into master will not change coverage

@@             master     #13188   diff @@
==========================================
  Files           138        138          
  Lines         51111      51111          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43107      43107          
  Misses         8004       8004          
  Partials          0          0          

Powered by Codecov. Last updated by 3944a36...b466fc1

with tm.assert_produces_warning(UserWarning):
_check_plot_works(self.ts.hist, by=self.ts.index.month)
with tm.assert_produces_warning(UserWarning):
_check_plot_works(self.ts.hist, by=self.ts.index.month, bins=5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ones are not generating a warning (and I also don't see why they should?)

@TomAugspurger TomAugspurger force-pushed the cleanup-testgraphicsother branch from 7e68600 to db82165 Compare June 25, 2016 12:47
@jorisvandenbossche
Copy link
Member

Maybe you can put the second commit for mpl compat in a separate PR if that is less of a problem.

@TomAugspurger TomAugspurger force-pushed the cleanup-testgraphicsother branch 2 times, most recently from 077b329 to 4882dd6 Compare June 25, 2016 17:34
@TomAugspurger
Copy link
Contributor Author

@jorisvandenbossche OK I'm giving up on this one I think :) Locally I get

nosetests pandas/tests/test_graphics_others.py:TestSeriesPlots.test_hist_layout_with_by
/Users/tom.augspurger/Envs/py3/lib/python3.5/site-packages/pandas/pandas/tools/plotting.py:2979: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
  ylabelsize=ylabelsize, yrot=yrot, **kwds)
/Users/tom.augspurger/Envs/py3/lib/python3.5/site-packages/pandas/pandas/tools/plotting.py:2979: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
  ylabelsize=ylabelsize, yrot=yrot, **kwds)
/Users/tom.augspurger/Envs/py3/lib/python3.5/site-packages/pandas/pandas/tools/plotting.py:2979: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
  ylabelsize=ylabelsize, yrot=yrot, **kwds)
/Users/tom.augspurger/Envs/py3/lib/python3.5/site-packages/pandas/pandas/tools/plotting.py:2979: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
  ylabelsize=ylabelsize, yrot=yrot, **kwds)
/Users/tom.augspurger/Envs/py3/lib/python3.5/site-packages/pandas/pandas/tools/plotting.py:2979: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
  ylabelsize=ylabelsize, yrot=yrot, **kwds)
/Users/tom.augspurger/Envs/py3/lib/python3.5/site-packages/pandas/pandas/tools/plotting.py:2979: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
  ylabelsize=ylabelsize, yrot=yrot, **kwds)
/Users/tom.augspurger/Envs/py3/lib/python3.5/site-packages/pandas/pandas/tools/plotting.py:2979: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
  ylabelsize=ylabelsize, yrot=yrot, **kwds)
.
----------------------------------------------------------------------
Ran 1 test in 9.987s

Not really sure what about my environment that's different than Travis, but it's green now so I'm good with this if you are.

@jreback
Copy link
Contributor

jreback commented Jun 25, 2016

you need to run more tests - prob some other test is suppressing the warnings

keep running more and more till they fail

@TomAugspurger TomAugspurger force-pushed the cleanup-testgraphicsother branch from 4882dd6 to 5e656d2 Compare June 25, 2016 19:29
@TomAugspurger
Copy link
Contributor Author

_check_plot_works should be setting the warnings to always be raised. Some other tests were setting another filter, tried removing that, so we'll see.

@TomAugspurger TomAugspurger force-pushed the cleanup-testgraphicsother branch from 5e656d2 to 8f1a459 Compare June 25, 2016 20:36
@jorisvandenbossche
Copy link
Member

@TomAugspurger The "UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared" you give is a very strange warning for that test, as there are no axes passed at all.

Translated, the test does this:

n = 100
gender = np.random.choice(['Male', 'Female'], size=n)
classroom = np.random.choice(['A', 'B', 'C'], size=n)
df = DataFrame({'gender': gender,
                'classroom': classroom,
                'height': np.random.normal(66, 4, size=n),
                'weight': np.random.normal(161, 32, size=n),
                'category': np.random.randint(4, size=n)})

axes = df.height.hist(by=df.gender, layout=(2, 1))

I do not get any warning for that locally if I run this in a console

@jorisvandenbossche
Copy link
Member

I also get those warnings if I run that single test with nosetests. But I see that _check_plot_works does add an ax keyword to the kwargs. So that can explain the warnings of course

@TomAugspurger
Copy link
Contributor Author

Ah, I didn't realize that _check_plot_works does that. I think refactoring that function to not do that would be difficult.

I can drop in some comments explaining what's going on.

@jorisvandenbossche
Copy link
Member

@TomAugspurger I didn't know as well. Good idea to add some comments why the catching of a warning is needed, then this should be good to merge

@TomAugspurger TomAugspurger force-pushed the cleanup-testgraphicsother branch from 8f1a459 to b466fc1 Compare June 29, 2016 21:59
@TomAugspurger
Copy link
Contributor Author

@jorisvandenbossche this is ready to go in I think.

@jorisvandenbossche jorisvandenbossche merged commit d38ee27 into pandas-dev:master Jul 5, 2016
@jorisvandenbossche
Copy link
Member

Merged!

@TomAugspurger Did it actually close #13185 ? (at the top, there is a 'maybe')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite Visualization plotting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FAIL: test_scatter_matrix_axis (pandas.tests.test_graphics_others.TestDataFramePlots) in 0.18.1 with py27
5 participants