1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| import pytest
|
| from pandas import (
| Series,
| Timedelta,
| TimedeltaIndex,
| timedelta_range,
| )
| import pandas._testing as tm
|
|
| @pytest.mark.parametrize(
| "cons",
| [
| lambda x: TimedeltaIndex(x),
| lambda x: TimedeltaIndex(TimedeltaIndex(x)),
| ],
| )
| def test_timedeltaindex(using_copy_on_write, cons):
| dt = timedelta_range("1 day", periods=3)
| ser = Series(dt)
| idx = cons(ser)
| expected = idx.copy(deep=True)
| ser.iloc[0] = Timedelta("5 days")
| if using_copy_on_write:
| tm.assert_index_equal(idx, expected)
|
|