Skip to content

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

Merged
merged 3 commits into from
Aug 9, 2018

Conversation

jbrockmendel
Copy link
Member

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.


@pytest.fixture(params=zeros)
def zero(request):
# For testing division by (or of) zero for Index with length 5, this
Copy link
Contributor

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')),
Copy link
Contributor

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)

Copy link
Member Author

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),
Copy link
Contributor

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)

Copy link
Member Author

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'])
Copy link
Contributor

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):
Copy link
Contributor

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):
Copy link
Contributor

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)

Copy link
Member Author

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):
Copy link
Contributor

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?

Copy link
Member Author

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.

@jreback jreback added the Testing pandas testing functions or related to the test suite label Aug 9, 2018
@codecov
Copy link

codecov bot commented Aug 9, 2018

Codecov Report

Merging #22254 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22254   +/-   ##
=======================================
  Coverage   92.07%   92.07%           
=======================================
  Files         169      169           
  Lines       50683    50683           
=======================================
  Hits        46666    46666           
  Misses       4017     4017
Flag Coverage Δ
#multiple 90.48% <ø> (ø) ⬆️
#single 42.34% <ø> (ø) ⬆️

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 8206c36...d255a6b. Read the comment docs.

@jreback jreback added this to the 0.24.0 milestone Aug 9, 2018
@jreback jreback merged commit 5a7d2b5 into pandas-dev:master Aug 9, 2018
@jreback
Copy link
Contributor

jreback commented Aug 9, 2018

thanks

@jbrockmendel jbrockmendel deleted the arith_tests5 branch August 9, 2018 15:57
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.

2 participants