Skip to content

TST/REF: Add more pytest idiom to tests/tslib #24587

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 1 commit into from
Jan 3, 2019

Conversation

gfyoung
Copy link
Member

@gfyoung gfyoung commented Jan 3, 2019

I was planning to correct individual files, but then I began to realize that the fixes were involving more and more files (was shifting tests around) in the directory, to the point that I just modified them all. 🙂

@gfyoung gfyoung added Refactor Internal refactoring of code Testing pandas testing functions or related to the test suite Datetime Datetime data dtype Timezones Timezone data dtype labels Jan 3, 2019
@gfyoung gfyoung added this to the 0.24.0 milestone Jan 3, 2019
@gfyoung gfyoung force-pushed the tests-tslib-pytest-idiom branch from fefffc1 to 16c4d84 Compare January 3, 2019 09:30
@codecov
Copy link

codecov bot commented Jan 3, 2019

Codecov Report

Merging #24587 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24587      +/-   ##
==========================================
- Coverage   92.38%   92.38%   -0.01%     
==========================================
  Files         166      166              
  Lines       52478    52478              
==========================================
- Hits        48483    48482       -1     
- Misses       3995     3996       +1
Flag Coverage Δ
#multiple 90.81% <ø> (ø) ⬆️
#single 43.05% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 88% <0%> (-0.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62506ca...646af2f. Read the comment docs.

@codecov
Copy link

codecov bot commented Jan 3, 2019

Codecov Report

Merging #24587 into master will decrease coverage by 49.32%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #24587       +/-   ##
===========================================
- Coverage   92.36%   43.03%   -49.33%     
===========================================
  Files         166      166               
  Lines       52497    52497               
===========================================
- Hits        48489    22593    -25896     
- Misses       4008    29904    +25896
Flag Coverage Δ
#multiple ?
#single 43.03% <ø> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/io/formats/latex.py 0% <0%> (-100%) ⬇️
pandas/core/categorical.py 0% <0%> (-100%) ⬇️
pandas/io/sas/sas_constants.py 0% <0%> (-100%) ⬇️
pandas/tseries/plotting.py 0% <0%> (-100%) ⬇️
pandas/tseries/converter.py 0% <0%> (-100%) ⬇️
pandas/io/formats/html.py 0% <0%> (-99.37%) ⬇️
pandas/core/groupby/categorical.py 0% <0%> (-95.46%) ⬇️
pandas/io/sas/sas7bdat.py 0% <0%> (-91.17%) ⬇️
pandas/io/sas/sas_xport.py 0% <0%> (-90.15%) ⬇️
pandas/core/tools/numeric.py 10.44% <0%> (-89.56%) ⬇️
... and 124 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0039158...16c4d84. Read the comment docs.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

looks good. some comments.

@jbrockmendel
Copy link
Member

Is this just getting rid of a level of indentation by removing the classes? I get that they don't serve much functional purpose, but do find them helpful for organization. Is there a preferred idiom for organization?

@gfyoung
Copy link
Member Author

gfyoung commented Jan 3, 2019

@jbrockmendel : In general, small, modular, functional test cases would be preferred I think (both for consistency with pytest idiom and readability, especially the short and modular part). I agree that test classes can be useful, especially when we are sharing test cases amongst multiple files or the test file is massive and has several super distinct collections of tests.

That being said, for this situation, I did not really find that to be the case for tests/tslibs. Note that this PR attempts to reorganize the tests a little as well as add a lot more parameterization (in interests of the short and modular).

I don’t think we will have a unified style for tests. We might prefer functional, but I wouldn’t force it everywhere if the (semantic) organization does not dictate it to be so.

@gfyoung gfyoung force-pushed the tests-tslib-pytest-idiom branch from 16c4d84 to 646af2f Compare January 3, 2019 20:28
@gfyoung
Copy link
Member Author

gfyoung commented Jan 3, 2019

@jreback : Addressed all comments, and everything is green. PTAL.

@jreback jreback merged commit 10650b1 into pandas-dev:master Jan 3, 2019
@jreback
Copy link
Contributor

jreback commented Jan 3, 2019

thanks @gfyoung

@gfyoung gfyoung deleted the tests-tslib-pytest-idiom branch January 3, 2019 21:46
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Refactor Internal refactoring of code Testing pandas testing functions or related to the test suite Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants