Skip to content

Commit 74a48bd

Browse files
committed
Updated test
1 parent ac41506 commit 74a48bd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pandas/tests/scalar/timedelta/test_timedelta.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,19 @@ def test_unit_parser(self, units, np_unit, wrapper):
348348

349349
result = to_timedelta('2{}'.format(unit))
350350
assert result == expected
351-
result = Timedelta('2{}'.format(unit))
351+
result = Timedelta('2{}'.format(units))
352352
assert result == expected
353353

354354
@pytest.mark.parametrize('units', ['Y', 'y', 'M'])
355-
def test_unit_M_Y_deprecated(self, units):
356-
with tm.assert_produces_warning(FutureWarning):
355+
def test_unit_m_y_deprecated(self, units):
356+
with pytest.warns(FutureWarning) as record1:
357357
to_timedelta(10, units)
358-
TimedeltaIndex([1, 1, 1], units)
358+
assert len(record1) == 1
359+
assert str(record1[0].message) == "M and Y units are deprecated."
360+
with pytest.warns(FutureWarning) as record2:
359361
Timedelta(10, units)
362+
assert len(record2) == 1
363+
assert str(record2[0].message) == "M and Y units are deprecated."
360364

361365
def test_numeric_conversions(self):
362366
assert ct(0) == np.timedelta64(0, 'ns')

0 commit comments

Comments
 (0)