Skip to content

TST: Remove dupe TimdeltaIndex tests from indexes/timedeltas/test_astype.py #19509

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 1 commit into from
Feb 4, 2018

Conversation

jschendel
Copy link
Member

@jschendel jschendel commented Feb 2, 2018

  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

Both classes in test_astype.py and test_timedelta.py inherit from DatetimeLike, which in turn inherits from Base, leading to 200+ dupe tests being run.

Modified test_astype.py to inherit from object instead, removed some unnecessary boilerplate, and removed some additional tests that were specified to override base class tests.


def test_shift(self):
# test shift for TimedeltaIndex
# err8083
Copy link
Member Author

Choose a reason for hiding this comment

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

note that this same test is also in test_arithmetic.py, and is overriden in test_timedeltas:

def test_shift(self):
pass # this is handled in test_arithmetic.py

def test_tdi_shift_int(self):
# GH#8083
trange = pd.to_timedelta(range(5), unit='d') + pd.offsets.Hour(1)
result = trange.shift(1)
expected = TimedeltaIndex(['1 days 01:00:00', '2 days 01:00:00',
'3 days 01:00:00',
'4 days 01:00:00', '5 days 01:00:00'],
freq='D')
tm.assert_index_equal(result, expected)
def test_tdi_shift_nonstandard_freq(self):
# GH#8083
trange = pd.to_timedelta(range(5), unit='d') + pd.offsets.Hour(1)
result = trange.shift(3, freq='2D 1s')
expected = TimedeltaIndex(['6 days 01:00:03', '7 days 01:00:03',
'8 days 01:00:03', '9 days 01:00:03',
'10 days 01:00:03'], freq='D')
tm.assert_index_equal(result, expected)

@codecov
Copy link

codecov bot commented Feb 2, 2018

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #19509   +/-   ##
=======================================
  Coverage   91.69%   91.69%           
=======================================
  Files         148      148           
  Lines       48561    48561           
=======================================
  Hits        44530    44530           
  Misses       4031     4031
Flag Coverage Δ
#multiple 90.06% <ø> (ø) ⬆️
#single 41.72% <ø> (ø) ⬆️

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 69cd5fb...1a43bb5. Read the comment docs.

@jbrockmendel
Copy link
Member

+1

FWIW there are some other astype tests that may be in suboptimal locations:

test_timedelta.test_freq_conversion (and the Series cases probably belong elsewhere)
test_ops.test_astype_object


class TestTimedeltaIndex(DatetimeLike):
_holder = TimedeltaIndex
class TestTimedeltaIndex(object):
_multiprocess_can_split_ = True
Copy link
Contributor

Choose a reason for hiding this comment

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

remove any of these _multi precess_can_split, they are really old

Copy link
Contributor

Choose a reason for hiding this comment

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

actually let's do that separately.

@jreback jreback added Testing pandas testing functions or related to the test suite Timedelta Timedelta data type labels Feb 4, 2018
@jreback jreback added this to the 0.23.0 milestone Feb 4, 2018
@jreback jreback merged commit 1bf7688 into pandas-dev:master Feb 4, 2018
@jreback
Copy link
Contributor

jreback commented Feb 4, 2018

thanks!

@jschendel jschendel deleted the tdi-dupe-tests branch February 4, 2018 18:52
harisbal pushed a commit to harisbal/pandas that referenced this pull request Feb 28, 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 Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants