Skip to content
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

TST: fixturize series/test_alter_axes.py #22526

Merged
merged 3 commits into from
Sep 5, 2018

Conversation

h-vetinari
Copy link
Contributor

@h-vetinari h-vetinari commented Aug 28, 2018

In particular, it takes the fixture-like attributes of tests/series/common.TestData and transforms them into fixtures in tests/series/conftest.py, with the eventual goal of replacing all the TestData-attributes in the Series tests, similar to #22471 (I can also open a sister issue to that for the Series tests).

@codecov
Copy link

codecov bot commented Aug 28, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #22526      +/-   ##
==========================================
+ Coverage   92.04%   92.04%   +<.01%     
==========================================
  Files         169      169              
  Lines       50782    50782              
==========================================
+ Hits        46742    46744       +2     
+ Misses       4040     4038       -2
Flag Coverage Δ
#multiple 90.45% <ø> (ø) ⬆️
#single 42.31% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 85.96% <0%> (+0.2%) ⬆️

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 f82c10a...4270363. Read the comment docs.

@jreback jreback added the Testing pandas testing functions or related to the test suite label Aug 29, 2018

class TestSeriesAlterAxes():
Copy link
Contributor

Choose a reason for hiding this comment

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

inherit from object as more explicit

from pandas import Series


@pytest.fixture
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add doc-strings and meaningful names for these. (e.g. ts -> datetime_series)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what docstrings you imagine. Something like """A datetime series"""?

Copy link
Contributor

Choose a reason for hiding this comment

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

see pandas/conftest.py for examples, yes that might be ok, the point is new features need a doc-string



@pytest.fixture
def series():
Copy link
Contributor

Choose a reason for hiding this comment

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

string_series



@pytest.fixture
def objSeries():
Copy link
Contributor

Choose a reason for hiding this comment

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

object_series



@pytest.fixture
def empty():
Copy link
Contributor

Choose a reason for hiding this comment

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

empty_series

@h-vetinari
Copy link
Contributor Author

h-vetinari commented Aug 30, 2018

@jreback

can you add doc-strings and meaningful names for these. (e.g. ts -> datetime_series)

This is the same issue as in #22236 - these "fixture-like" TestData-attributes will need to be replaced in all Series tests, and renaming them now will make it harder to simply replace them (e.g. if someone were to work on a different module, to know that self.series needs to be replaced with string_series).

One possible approach to satisfy both demands would be to open up a sister issue to #22471 for Series, and have a "translation guide" like

  • self.ts -> datetime_series
  • self.series -> string_series
  • self.objSeries -> object_series
  • self.empty -> empty_series

The same approach could be applied to #22236 / #22471 if you're unhappy with the fixture names coming from TestData there (cc @gfyoung).

@h-vetinari
Copy link
Contributor Author

@jreback

I added the "translations" as requested - it's gonna make transitioning the other modules a fair bit harder, but for only four fixtures, I think it's doable.

@h-vetinari h-vetinari force-pushed the tst_series_alter_axes branch 2 times, most recently from 39b251d to 38afdfd Compare August 31, 2018 09:29
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.

doc comments, ping on green.

from pandas import Series


@pytest.fixture
Copy link
Contributor

Choose a reason for hiding this comment

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

see pandas/conftest.py for examples, yes that might be ok, the point is new features need a doc-string

@jreback jreback added this to the 0.24.0 milestone Aug 31, 2018
@pep8speaks
Copy link

pep8speaks commented Aug 31, 2018

Hello @h-vetinari! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on August 31, 2018 at 13:49 Hours UTC

@h-vetinari h-vetinari force-pushed the tst_series_alter_axes branch 2 times, most recently from 49a91c6 to c917d81 Compare August 31, 2018 13:49
@h-vetinari
Copy link
Contributor Author

@jreback

All green. This is very similar to #22236 - can I please ask you to take a look there again? I incorporated all your feedback (fixturize, split off warnings into new PR, etc.), and don't know what's left to do - it's been a very drawn-out process to eke out further instructions for what could have been a simple test clean-up.

Based on this review here, I now also added docstrings to the fixtures there; I didn't rename them yet (but added a note in each fixture), because otherwise the fixturization of the other modules would be that much harder (and it's much easier to run a simple search and replace once everything is translated, i.e. #22471 is done).

@jreback
Copy link
Contributor

jreback commented Aug 31, 2018

it’s long and drawn out because the PRs have too much unrelated changes in them

1 thing per PR will get u merged much faster with less comments

even things as simple as changing unrelated whatsnew notes

the more code the more i have to go over with a fine toothed comb

further responding to my comments with further questions - while for sure ask if things are unclear
can certainly make things take longer

@h-vetinari
Copy link
Contributor Author

h-vetinari commented Aug 31, 2018

@jreback

For sure, and I appreciate the effort you put in. But I've learned my lesson about the unrelated changes, and I've been splitting them into smaller and smaller pieces.

In #22236, the "unrelated" changes were - respectfully - mostly your requests at cleaning up things not directly related to the PR (except that it was in the same module), and I split off the new warnings as requested as well. The diffs of the last few commits are not very large at all (except the added docstrings now, which I'll happily revert if not necessary) - e.g. starting after your last review: https://github.com/pandas-dev/pandas/pull/22236/commits/9121d4912cdcd7f8a7e3336fc385bf00ccab93ad

@h-vetinari
Copy link
Contributor Author

h-vetinari commented Sep 4, 2018

@jreback anything left to do on this? Someone wants to already start working on fixturising the rest of the series tests, see #22550

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.

small comments ping on green.

@h-vetinari the pings are fine, but if someone wants to work on things based on this nothing is stopping them, they can rebase off of this PR, this is a quite common workflow. This will be merged after all comments are satisfied. Pls be patient. We have a tremendous amount of PRs

"""
Fixture for Series of floats with DatetimeIndex

See pandas.util.testing.makeTimeSeries
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think these See .. comments make sense here, just keep the summary line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed those comments

@h-vetinari
Copy link
Contributor Author

@jreback

@h-vetinari the pings are fine, but if someone wants to work on things based on this nothing is stopping them, they can rebase off of this PR, this is a quite common workflow. This will be merged after all comments are satisfied. Pls be patient. We have a tremendous amount of PRs

Yeah, I get there's lots of traffic. I mentioned this because this PR was basically finished and it's not a "beginner workflow" to rebase off an open PR.

@h-vetinari h-vetinari force-pushed the tst_series_alter_axes branch from a355f5f to 4270363 Compare September 5, 2018 11:49
@h-vetinari
Copy link
Contributor Author

h-vetinari commented Sep 5, 2018

@jreback

small comments ping on green.

ping on green

@jreback jreback merged commit 46abe18 into pandas-dev:master Sep 5, 2018
@jreback
Copy link
Contributor

jreback commented Sep 5, 2018

thanks!

@h-vetinari h-vetinari deleted the tst_series_alter_axes branch September 9, 2018 21:22
@h-vetinari h-vetinari mentioned this pull request Sep 18, 2018
5 tasks
aeltanawy pushed a commit to aeltanawy/pandas that referenced this pull request Sep 20, 2018
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants