Skip to content

TST: Verify functioning of histtype argument (GH23992) #37063

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
merged 13 commits into from
Nov 1, 2020

Conversation

avinashpancham
Copy link
Contributor

@avinashpancham
Copy link
Contributor Author

@mroeschke you added the testing label to the original issue. Could you maybe have a look whether this test meets the standards? Thanks!

@mroeschke mroeschke added Testing pandas testing functions or related to the test suite Visualization plotting labels Oct 22, 2020
@mroeschke
Copy link
Member

Not as familiar with this part of the code base but tagged appropriately.

Copy link
Member

@charlesdong1991 charlesdong1991 left a comment

Choose a reason for hiding this comment

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

thanks @avinashpancham for the PR

i put a few comments for feedback

@@ -173,6 +173,27 @@ def _check_visible(self, collections, visible=True):
for patch in collections:
assert patch.get_visible() == visible

def _check_filled(self, ax, filled=True):
Copy link
Member

Choose a reason for hiding this comment

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

i would suggest to rename it, since _check_filled sounds a bit vague to me

also would be nice to annotate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated name to _check_filling.

What do you mean with annotate, since the function already has a docstring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry my bad, I was bit confused wrt to annotation. Added annotation to all new functions

Copy link
Member

@charlesdong1991 charlesdong1991 Oct 29, 2020

Choose a reason for hiding this comment

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

emm, i meant to give it a more meaningful name than _check_filling, maybe use _check_patches_all_filled or _check_artists_all_filled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to _check_patches_all_filled

@avinashpancham
Copy link
Contributor Author

@charlesdong1991 I have some issues when adding the type annotations, since the CI produces the error below. Locally this works since I have installed matplotlib in my env. How should I add the type annotation if matplotlib is not available on he machine, cause at the moment I am a bit stuck.

    from matplotlib.axes import Axes
E   ModuleNotFoundError: No module named 'matplotlib'

@charlesdong1991
Copy link
Member

charlesdong1991 commented Oct 29, 2020

emm, maybe could you try this?

from typing import TYPE_CHECKING
if TYPE_CHECKING:
    from matplotlib.axes import Axes

("stepfilled", True),
],
)
def test_histtype_argument(self, histtype: str, expected: bool) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

pls remove annotations for tests.

maybe i wasn't clear enough, I only meant to add annotation for the helper function you add in common.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

("stepfilled", True),
],
)
def test_histtype_argument(self, histtype: str, expected: bool) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

the same here and below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@avinashpancham
Copy link
Contributor Author

CI encountered "RuntimeError: can't start new thread". Would it be possible to restart the CI? Thanks!

@avinashpancham
Copy link
Contributor Author

@charlesdong1991 updated the code, merged master and CI is on green. Could you review it again?

@jreback jreback added this to the 1.2 milestone Oct 31, 2020
@jreback
Copy link
Contributor

jreback commented Oct 31, 2020

@charlesdong1991 over to you, merge when good

@avinashpancham
Copy link
Contributor Author

avinashpancham commented Oct 31, 2020

Sorry I saw I forgot to rename function _check_fillingto _check_patches_all_filled. Did it now and pushed it

@avinashpancham
Copy link
Contributor Author

OK, everything is done now :)

Copy link
Member

@charlesdong1991 charlesdong1991 left a comment

Choose a reason for hiding this comment

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

thanks @avinashpancham very nice!

@charlesdong1991 charlesdong1991 merged commit 56a9e75 into pandas-dev:master Nov 1, 2020
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
)

* TST: Verify functioning of histtype argument (GH23992)

* Generalize checks and store in common.py

* Update _check_filling function

* Add type hinting

* Update Axis reference to be in line with plotting/_matplotlib/tools.py

* Add conditional import of matplotlib

* Remove type hinting from tests

* Rename function as requested
ukarroum pushed a commit to ukarroum/pandas that referenced this pull request Nov 2, 2020
)

* TST: Verify functioning of histtype argument (GH23992)

* Generalize checks and store in common.py

* Update _check_filling function

* Add type hinting

* Update Axis reference to be in line with plotting/_matplotlib/tools.py

* Add conditional import of matplotlib

* Remove type hinting from tests

* Rename function as requested
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.

step option does not work for hist
4 participants