-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Organize, Split, Parametrize timezones/timestamps tests #19473
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19473 +/- ##
==========================================
+ Coverage 91.6% 91.62% +0.01%
==========================================
Files 150 150
Lines 48724 48728 +4
==========================================
+ Hits 44632 44645 +13
+ Misses 4092 4083 -9
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again instead of moving around inside a single file, just make a sub-directory an move to separate files. it is much easier to discover things.
pandas/tests/scalar/timestamp/test_.....
|
||
def test_pprint(self): | ||
# GH#12622 | ||
import pprint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you import at the top
'2014-01-01 00:00:00.000000001']) | ||
def test_repr(self, date, freq): | ||
# dateutil zone change (only matters for repr) | ||
if LooseVersion(dateutil.__version__) >= LooseVersion('2.6.0'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timezones can be parameterized here
OK. So pretty much one class per file? |
Just pushed a commit that splits a chunk of scalar.test_timestamps into scalar.timestamps.test_*. This will take a few steps. After looking at the results I agree you're right this is a nice layout. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small change. ping on grenn.
with pytest.raises(AmbiguousTimeError): | ||
ts.tz_localize('US/Pacific', errors='coerce') | ||
|
||
@pytest.mark.parametrize('tz', ['UTC', 'Asia/Tokyo', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eventually we want to propagate all of these to higher level fixtures (the tz I am talking about)
@@ -704,6 +471,31 @@ def test_today(self): | |||
assert (abs(ts_from_string_tz.tz_localize(None) - | |||
ts_from_method_tz.tz_localize(None)) < delta) | |||
|
|||
|
|||
class TestTimestamp(object): | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should go in scalar/test_timezones , yes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to leave this one out of this round until I make up my mind on exactly where it belongs. test_tz
isn't very informative, so it will likely be split into method-specific tests, many of which likely already exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small change. ping on green.
ping |
thanks, spitting like this is very welcome. you may need to rebase other PRs. |
test_timezones has a small subset of tests that specifically tests tslibs.timezones, but most of it makes much more sense to organize with the appropriate Timestamp and DatetimeIndex tests. Otherwise we get (as in the status quo) a ton of duplicate and near-duplicate tests for e.g. tz_localize in both test_timezones and test_timestamps.
This PR starts that cleanup for timestamps. Will wait on DTI pending feedback.