Skip to content

Commit d908283

Browse files
jbrockmendelpull[bot]
authored andcommitted
TST: parametrize/de-duplicate arithmetic tests (#44962)
1 parent 2b0153e commit d908283

File tree

5 files changed

+206
-399
lines changed

5 files changed

+206
-399
lines changed

pandas/core/indexes/range.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,11 @@ def _arith_method(self, other, op):
10411041
rstop = op(left.stop, right)
10421042

10431043
res_name = ops.get_op_result_name(self, other)
1044-
result = type(self)(rstart, rstop, rstep, name=res_name)
1044+
with warnings.catch_warnings():
1045+
warnings.simplefilter("ignore", DeprecationWarning)
1046+
# The constructor validation can lead to a DeprecationWarning
1047+
# from numpy, e.g. with RangeIndex + np.datetime64("now")
1048+
result = type(self)(rstart, rstop, rstep, name=res_name)
10451049

10461050
# for compat with numpy / Int64Index
10471051
# even if we can represent as a RangeIndex, return

pandas/tests/arithmetic/conftest.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ def numeric_idx(request):
107107

108108
@pytest.fixture(
109109
params=[
110-
pd.Timedelta("5m4s").to_pytimedelta(),
111-
pd.Timedelta("5m4s"),
112-
pd.Timedelta("5m4s").to_timedelta64(),
110+
pd.Timedelta("10m7s").to_pytimedelta(),
111+
pd.Timedelta("10m7s"),
112+
pd.Timedelta("10m7s").to_timedelta64(),
113113
],
114114
ids=lambda x: type(x).__name__,
115115
)
116116
def scalar_td(request):
117117
"""
118-
Several variants of Timedelta scalars representing 5 minutes and 4 seconds
118+
Several variants of Timedelta scalars representing 10 minutes and 7 seconds.
119119
"""
120120
return request.param
121121

0 commit comments

Comments
 (0)