8000 TST: Extend timedelta64 arithmetic tests to TimedeltaArray by jbrockmendel · Pull Request #23642 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

TST: Extend timedelta64 arithmetic tests to TimedeltaArray #23642

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 24 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e6463be
implement box_with_timedelta, assert_timedelta_array_equal, and minim…
jbrockmendel Nov 12, 2018
f5a7891
extend tests for floordiv
jbrockmendel Nov 12, 2018
291dd51
extend tests to multiplication
jbrockmendel Nov 12, 2018
52319fd
extend tests for floordiv
jbrockmendel Nov 12, 2018
da1b45a
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 12, 2018
0b21797
extend tests to int/float
jbrockmendel Nov 12, 2018
cb63fe7
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 12, 2018
6ccff81
isort fixup
jbrockmendel Nov 12, 2018
1ffc21f
suggested edits
jbrockmendel Nov 12, 2018
8c9f296
Fixup unused import
jbrockmendel Nov 12, 2018
3c53183
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 15, 2018
74046ba
implement abs, tests
jbrockmendel Nov 15, 2018
1c9fb1a
test fixups
jbrockmendel Nov 15, 2018
9f4d4d9
Merge branch 'pre-arith' of https://github.com/jbrockmendel/pandas in…
jbrockmendel Nov 15, 2018
07c858e
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 17, 2018
b8e2127
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 17, 2018
6dd6b3b
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 18, 2018
9c11a6c
use box_with_array instead of box_with_timedelta
jbrockmendel Nov 18, 2018
e4c7e98
update fixture usages
jbrockmendel Nov 18, 2018
cf97665
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 18, 2018
62edbc3
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 18, 2018
fa3e8d1
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 19, 2018
4cc3cbd
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 19, 2018
2df7d65
Merge branch 'master' of https://github.com/pandas-dev/pandas into pr…
jbrockmendel Nov 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
suggested edits
  • Loading branch information
jbrockmendel committed Nov 12, 2018
commit 1ffc21fc705e36292077a4986be8382912b8f551
5 changes: 4 additions & 1 deletion pandas/core/arrays/timedeltas.py
10045
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ def wrapper(self, other):
def _wrap_tdi_op(op):
"""
Instead of re-implementing multiplication/division etc operations
in the Array class, for now we dispatch to the Timedelta implementations.
in the Array class, for now we dispatch to the TimedeltaIndex
implementations.
"""
# TODO: implement directly here and wrap in TimedeltaIndex, instead of
# the other way around
def method(self, other):
if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)):
return NotImplemented
Expand Down
14 changes: 7 additions & 7 deletions pandas/tests/arithmetic/test_timedelta64.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,23 +467,23 @@ def test_td64arr_add_sub_timestamp(self, box):
ts = Timestamp('2012-01-01')
# TODO: parametrize over types of datetime scalar?

tdser = timedelta_range('1 day', periods=3)
tdarr = timedelta_range('1 day', periods=3)
expected = pd.date_range('2012-01-02', periods=3)

tdser = tm.box_expected(tdser, box)
tdarr = tm.box_expected(tdarr, box)
expected = tm.box_expected(expected, box)

tm.assert_equal(ts + tdser, expected)
tm.assert_equal(tdser + ts, expected)
tm.assert_equal(ts + tdarr, expected)
tm.assert_equal(tdarr + ts, expected)

expected2 = pd.date_range('2011-12-31', periods=3, freq='-1D')
expected2 = tm.box_expected(expected2, box)

tm.assert_equal(ts - tdser, expected2)
tm.assert_equal(ts + (-tdser), expected2)
tm.assert_equal(ts - tdarr, expected2)
tm.assert_equal(ts + (-tdarr), expected2)

with pytest.raises(TypeError):
tdser - ts
tdarr - ts

def test_tdi_sub_dt64_array(self, box_with_timedelta):
box = box_with_timedelta
Expand Down
0