Skip to content

Parametrize tests for Series[timedelta64] integer arithmetic #19166

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 8 commits into from
Jan 12, 2018

Conversation

jbrockmendel
Copy link
Member

Breaks up a few big tests, parametrizes, covers cases much more thoroughly including identifying a few new xfails.

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

assert_series_equal(s + ts, expected)
class TestTimedeltaSeriesArithmeticWithIntegers(object):
@classmethod
def setup_class(cls):
Copy link
Contributor

Choose a reason for hiding this comment

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

don't setup the class, rather use a fixture

assert_series_equal(ts + s, expected)
assert_series_equal(s + ts, expected)
class TestTimedeltaSeriesArithmeticWithIntegers(object):
@classmethod
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this seems obvious but add a comment on what this class is testing

@jreback jreback added Testing pandas testing functions or related to the test suite Datetime Datetime data dtype Timedelta Timedelta data type labels Jan 10, 2018
pytest.raises(TypeError, sop, s2.values)

class TestTimedeltaSeriesArithmetic(object):
def test_timedelta_series_ops(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

doc-string

@codecov
Copy link

codecov bot commented Jan 10, 2018

Codecov Report

Merging #19166 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #19166      +/-   ##
==========================================
+ Coverage   91.52%   91.52%   +<.01%     
==========================================
  Files         148      147       -1     
  Lines       48778    48773       -5     
==========================================
- Hits        44642    44638       -4     
+ Misses       4136     4135       -1
Flag Coverage Δ
#multiple 89.89% <ø> (ø) ⬆️
#single 41.62% <ø> (+0.01%) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 84.2% <0%> (-0.22%) ⬇️
pandas/core/frame.py 97.62% <0%> (ø) ⬆️
pandas/tools/hashing.py
pandas/core/internals.py 94.49% <0%> (+0.06%) ⬆️
pandas/core/dtypes/cast.py 88.58% <0%> (+0.15%) ⬆️
pandas/core/ops.py 92.06% <0%> (+0.17%) ⬆️

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 982e112...5560f07. Read the comment docs.

@jreback jreback added this to the 0.23.0 milestone Jan 11, 2018
# Addition and Subtraction

def test_td64series_add_int_series_invalid(self):
tdser = Series(['59 Days', '59 Days', 'NaT'], dtype='timedelta64[ns]')
Copy link
Contributor

Choose a reason for hiding this comment

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

since you are repeating this everywhere, use a fixture for tdser

Copy link
Member Author

Choose a reason for hiding this comment

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

Any wiggle room on this request? I really prefer to be able to tell what is going on in a test just by looking at it, to be able to just copy/paste the text of a test when something goes wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

no wiggle room. This just adds so much boilerplate. that is the entire purpose of fixtures, to avoid copy-paste boilerplate.

@jreback jreback merged commit 27a5039 into pandas-dev:master Jan 12, 2018
@jreback
Copy link
Contributor

jreback commented Jan 12, 2018

thanks!

@jbrockmendel jbrockmendel deleted the paramtests branch February 11, 2018 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Testing pandas testing functions or related to the test suite Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants