-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Implement arithmetic.test_numeric and arithmetic.test_object #22254
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
|
||
@pytest.fixture(params=zeros) | ||
def zero(request): | ||
# For testing division by (or of) zero for Index with length 5, this |
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.
ideall can you come back and put a doc-string on all of the fixtures here (use triple quotes)
return request.param | ||
|
||
|
||
@pytest.fixture(params=[pd.Float64Index(np.arange(5, dtype='float64')), |
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.
call this something else, idx is too specific a name (and it is used heavily elsewhere)
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.
Will do in next pass (hopefully tomorrow)
|
||
@pytest.mark.parametrize( | ||
'box, assert_func', | ||
[(Series, tm.assert_series_equal), |
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.
note that we now have tm.assert_equal
to solve cases like this (certainly can change later though)
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.
Yep, I'm looking forward to getting rid of this hack
|
||
@pytest.mark.parametrize('op', ['__add__', '__radd__', | ||
'__sub__', '__rsub__']) | ||
@pytest.mark.parametrize('tz', [None, '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.
note to use the tz fixtures
# ------------------------------------------------------------- | ||
# Timezone-Centric Tests | ||
|
||
def test_operators_datetimelike_with_timezones(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.
maybe move to a separate test_timezones.py (later is ok too)
pd.Int64Index(np.arange(5, dtype='int64')), | ||
pd.RangeIndex(5)], | ||
ids=lambda x: type(x).__name__) | ||
def idx(request): |
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.
duplicate of conftest (maybe that's ok)
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.
Yah, I'm not going to worry about fixture duplication until after tests.test_arithmetic is moved to tests.arithmetic.test_timedelta64
|
||
class TestDivisionByZero(object): | ||
|
||
def test_div_zero(self, zero, idx): |
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.
are these specific to Index tests? or are they moving so that you can consolidate later?
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.
or are they moving so that you can consolidate later?
Yes, very nearly everything in this PR is moved with minimal changes so they can be de-duplicated and parametrized/fixturized in an upcoming pass.
Codecov Report
@@ Coverage Diff @@
## master #22254 +/- ##
=======================================
Coverage 92.07% 92.07%
=======================================
Files 169 169
Lines 50683 50683
=======================================
Hits 46666 46666
Misses 4017 4017
Continue to review full report at Codecov.
|
thanks |
Also move a bunch more dt64 and td64 tests that have been hiding. For the most part this doesn't do any of the parametrizing over box-classes; that and a bunch of de-duplication are for the next pass.