Skip to content

TST: Timestamp and Timeseries tests reorg (gh14854) #15301

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

Closed
wants to merge 4 commits into from
Closed

TST: Timestamp and Timeseries tests reorg (gh14854) #15301

wants to merge 4 commits into from

Conversation

TrigonaMinima
Copy link

@TrigonaMinima TrigonaMinima commented Feb 3, 2017

  • Partially completes TST: timeseries tests reorg #14854
  • Tests reorganized (test_timeseries.py + test_tslib.py -> test_timestamp.py)
  • Passes git diff upstream/master | flake8 --diff

@jreback jreback added the Testing pandas testing functions or related to the test suite label Feb 3, 2017
@jreback
Copy link
Contributor

jreback commented Feb 3, 2017

lgtm. the remainder of tseries/test_timeseries.py can prob go in tests/series/test_timestamp.py (or can move the obvious stuff). Then can look and see what remains.

thanks!

@jreback jreback added this to the 0.20.0 milestone Feb 3, 2017
@TrigonaMinima
Copy link
Author

Wouldn't the remaining tests of tseries/test_timeseries.py go in tests/series/test_timeseries.py instead of tests/series/test_timestamp.py? You have also mentioned the same in the issue ( #14854 3rd point).

@jreback
Copy link
Contributor

jreback commented Feb 3, 2017

@TrigonaMinima yes, sorry, that's what I meant!

of course if you find say a period test or something, move to the appropriate place.

@codecov-io
Copy link

codecov-io commented Feb 4, 2017

Codecov Report

Merging #15301 into master will not impact coverage.

@@           Coverage Diff           @@
##           master   #15301   +/-   ##
=======================================
  Coverage   86.33%   86.33%           
=======================================
  Files         139      139           
  Lines       51149    51149           
=======================================
  Hits        44157    44157           
  Misses       6992     6992

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 9ddba8d...285387f. Read the comment docs.

@TrigonaMinima TrigonaMinima changed the title TST: Timestamp tests compiled (gh14854) TST: Timestamp and Timeseries tests reorg (gh14854) Feb 4, 2017
@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

ok a lot of the move into tests/series/test_timestamp.py was composed of things (that can be split out)

  • fillna (on series) can go to test_missing
  • move pure date_range tests an go to indexes/datetimes/test_date_range (new file)
  • maybe some pure Timestamp things to scalar/test_timestamp

@TrigonaMinima
Copy link
Author

TrigonaMinima commented Feb 4, 2017

You meant tests/series/test_timeseries.py, right? 😄

It's still large though.

@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

@TrigonaMinima yeah. Need to separate pieces out as much as possible (though still may end up large). ok for now. I'll take a look and move more.

expected = expected.to_sparse()
assert_series_equal(result, expected)

def test_sparse_series_pad_backfill_limit(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

forgot to mention, these sparse routines can go in

pandas/sparse/tests/test_series.py

expected = expected.to_sparse()
assert_series_equal(result, expected)

def test_series_pad_backfill_limit(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

anything backfill or interpolate can also do in pandas/tests/series/test_missing

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, I realized you already moved this, nvm!

Copy link
Author

Choose a reason for hiding this comment

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

They are in test_missing only. Though there are some frame backfill routines which are in test_timeseries.py. Should they be moved here as well?

expected = s[-2:].reindex(index).fillna(method='backfill')
expected[:3] = np.nan
assert_series_equal(result, expected)


class TestSeriesInterpolateData(TestData, tm.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

in fact this whole class can be moved

Copy link
Author

Choose a reason for hiding this comment

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

already in test_missing 🙂

@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

@TrigonaMinima just ping on green. I'll do a follow on this stuff to fix a couple of little points.

If you can continue on to other things would be great!

@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

@TrigonaMinima don't push anymore to this. I have already taken your commit (and going to merge it soon), along with a bunch of other changes.

@TrigonaMinima
Copy link
Author

Sure. When I pushed it there wasn't anything. Sorry for that.

@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

@TrigonaMinima if you are game, love to move timedelta and period in a similar way (e.g. move the scalar tests and index tests). you can create a indexes/timedeltas,period sub-dir

e.g. for timedelta separate out the to_timedelta stuff into a separate file apart from multiple files for timedelta index consruction / ops etc.

similar for period.

@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

also you can move tserites/tests/test_daterange.py to indexes/datetimes/test_date_range (add to same file).

@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

and tseries/tests/test_tslib.py can go to (you will have to move classes / individual test)
can also hit tseires/tests_util.py at same time I think.

  • test_timezones.py (only move stuff that is actually doing timezone stuff, not parsing timezones, that will be in below)
  • indexes/datetimes/test_tools.py (for parsing and tslib.* routines)
  • test_period.py
  • a couple of random things at the bottom have to find a good spot.

do this after I merge (shortly) and separately from everything else as this will touch lots of things.

@TrigonaMinima
Copy link
Author

TrigonaMinima commented Feb 4, 2017

@jreback sure. I just have a couple of questions-

  • Why are there tests outside tests directory? What's the difference between these tests in pandas/tests and in each sub directory under pandas? Is it by design?
  • What goes under scalars and what goes under indexes. Some routines seemed to me as if they could go anywhere. So if there is some part of documentation where i can know the difference or may be you can explain it to me.

Also, just clarifying, I should do timedelta changes in a different PR right?

@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

yes, leave this PR alone. timedelta is a separate PR.

in theory everything should be under pandas/tests (sub-dirs of). but we have historically not done that, so slowly moving things.

so in the scalar dir are Timestamp, Timedelta, Period specific things, as opposed to DatetimeIndex, TimedeltaIndex, PeriodIndex (which are the indexes which wrap these scalars).

e.g. a method/property of Timestamp belongs in scalar, while using Timestamp to say subtract from a DatetimeIndex belong in indexes.

the tests dir should be almost self-explanatory, with it obvious where a new tests should go. there should be 1 and only 1 place.

@jreback jreback closed this in 69a9b05 Feb 4, 2017
@jreback
Copy link
Contributor

jreback commented Feb 4, 2017

merged!

@TrigonaMinima
Copy link
Author

Thanks. The explanation made things clearer.

@TrigonaMinima TrigonaMinima deleted the gh14854-timestamp branch February 4, 2017 18:37
AnkurDedania pushed a commit to AnkurDedania/pandas that referenced this pull request Mar 21, 2017
xref partial on pandas-dev#14854

Author: TrigonaMinima <[email protected]>

Closes pandas-dev#15301 from TrigonaMinima/gh14854-timestamp and squashes the following commits:

d8e3f4d [TrigonaMinima] splitting test_timeseries.py further
4072d93 [TrigonaMinima] TST: tseries/tests/test_timeseries.py tests moved to appropriate places.
dbfd2ba [TrigonaMinima] TST: Timestamp tests compiled (gh14854)
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