-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Collect tslibs test, organize PeriodIndex tests #19627
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
@@ -933,3 +935,16 @@ def test_datetime64_with_DateOffset(klass, assert_func): | |||
Timestamp('2000-02-29', tz='US/Central')], name='a') | |||
assert_func(result, exp) | |||
assert_func(result2, exp) | |||
|
|||
|
|||
@pytest.mark.parametrize('years,months', product([-1, 0, 1], [-2, 0, 2])) |
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.
If you parametrize years & months separately, pytest will handle the product
i.e. @pytest.mark.parametrize(('years',[-1, 0, 1]), ('months', [-2, 0, 2]))
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.
lots of nice changes. but pls split into smaller prs. move by type (timedelta, period, timestamp & parsing)
@@ -138,6 +138,48 @@ def test_astype_object(self): | |||
tm.assert_index_equal(casted, Index(exp_values, dtype=np.object_)) | |||
assert casted.tolist() == exp_values | |||
|
|||
idx = pd.date_range(start='2013-01-01', periods=4, freq='M', |
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 avoid duplication of lots of code and just parameterize over the tz.
|
||
|
||
def test_to_datetime1(): | ||
actual = pd.to_datetime(datetime(2008, 1, 15)) |
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 add a refernce for this test (e.g. what is it testing)
can you put it near other tests that are similar
@@ -250,6 +250,79 @@ def test_sub_isub(self): | |||
rng -= 1 | |||
tm.assert_index_equal(rng, expected) | |||
|
|||
# ------------------------------------------------------------------ | |||
# PeriodIndex.shift is used by __add__ and __sub__ |
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 parameterize
|
||
assert period_asfreq(1, get_freq('U'), get_freq('N'), False) == 1000 | ||
|
||
def test_period_ordinal_start_values(self): |
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.
parameterize
|
||
def test_period_ordinal_start_values(self): | ||
# information for 1.1.1970 | ||
assert period_ordinal(1970, 1, 1, 0, 0, 0, 0, 0, get_freq('A')) == 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.
same
|
||
def test_period_ordinal_week(self): | ||
assert period_ordinal(1970, 1, 4, 0, 0, 0, 0, 0, get_freq('W')) == 1 | ||
assert period_ordinal(1970, 1, 5, 0, 0, 0, 0, 0, get_freq('W')) == 2 |
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.
same
assert (result == datetime(2012, 9, 7)) | ||
|
||
|
||
class TestParseISO8601(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.
these are conversion tests no? (so separate file). I don't really want much in tslib/test_testlib.py except if it doesnt' fit anywhere else
see comments above |
@maxim-lian good catch; I'll do that in the next draft. |
Parametrize a bunch of nested tests.