Skip to content

CLN: de-duplicate in arithmetic/test_numeric #37215

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
Oct 20, 2020
Merged
Changes from all commits
Commits
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
15 changes: 4 additions & 11 deletions pandas/tests/arithmetic/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,31 +172,24 @@ def test_div_td64arr(self, left, box_cls):
with pytest.raises(TypeError, match=msg):
left // right

# TODO: de-duplicate with test_numeric_arr_mul_tdscalar
def test_ops_series(self):
# regression test for G#H8813
td = Timedelta("1 day")
other = pd.Series([1, 2])
expected = pd.Series(pd.to_timedelta(["1 day", "2 days"]))
tm.assert_series_equal(expected, td * other)
tm.assert_series_equal(expected, other * td)

# TODO: also test non-nanosecond timedelta64 and Tick objects;
# TODO: also test Tick objects;
# see test_numeric_arr_rdiv_tdscalar for note on these failing
@pytest.mark.parametrize(
"scalar_td",
[
Timedelta(days=1),
Timedelta(days=1).to_timedelta64(),
Timedelta(days=1).to_pytimedelta(),
Timedelta(days=1).to_timedelta64().astype("timedelta64[s]"),
Timedelta(days=1).to_timedelta64().astype("timedelta64[ms]"),
],
ids=lambda x: type(x).__name__,
)
def test_numeric_arr_mul_tdscalar(self, scalar_td, numeric_idx, box_with_array):
# GH#19333
box = box_with_array
index = numeric_idx
expected = pd.TimedeltaIndex([pd.Timedelta(days=n) for n in range(5)])
expected = pd.TimedeltaIndex([pd.Timedelta(days=n) for n in range(len(index))])

index = tm.box_expected(index, box)
expected = tm.box_expected(expected, box)
Expand Down