412554b2f06f3782c9336f5a4dfc5bb890219afd,pandas/tests/indexes/timedeltas/test_insert.py,TestTimedeltaIndexInsert,test_insert_mismatched_types_raises,#TestTimedeltaIndexInsert#Any#,89
Before Change
// GH/ dont cast these to td64
tdi = TimedeltaIndex(["4day", "1day", "2day"], name="idx")
msg = r"value should be a "Timedelta" or "NaT"\. Got ".*" instead\."
with pytest.raises(TypeError, match=msg):
tdi.insert(1, item)
def test_insert_dont_cast_strings(self):
// To match DatetimeIndex and PeriodIndex behavior, dont try to
// parse strings to Timedelta
idx = timedelta_range("1day", "3day")
After Change
result = tdi.insert(1, item)
expected = Index(
[tdi[0], lib.item_from_zerodim(item)] + list(tdi[1:]),
dtype=object,
name="idx",
)
tm.assert_index_equal(result, expected)
def test_insert_castable_str(self):
idx = timedelta_range("1day", "3day")
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 9
Instances
Project Name: pandas-dev/pandas
Commit Name: 412554b2f06f3782c9336f5a4dfc5bb890219afd
Time: 2021-01-21
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexes/timedeltas/test_insert.py
Class Name: TestTimedeltaIndexInsert
Method Name: test_insert_mismatched_types_raises
Project Name: pandas-dev/pandas
Commit Name: 412554b2f06f3782c9336f5a4dfc5bb890219afd
Time: 2021-01-21
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexes/datetimes/test_insert.py
Class Name: TestInsert
Method Name: test_insert_mismatched_types_raises
Project Name: pandas-dev/pandas
Commit Name: 412554b2f06f3782c9336f5a4dfc5bb890219afd
Time: 2021-01-21
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexes/datetimes/test_insert.py
Class Name: TestInsert
Method Name: test_insert_invalid_na
Project Name: pandas-dev/pandas
Commit Name: 412554b2f06f3782c9336f5a4dfc5bb890219afd
Time: 2021-01-21
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexes/timedeltas/test_insert.py
Class Name: TestTimedeltaIndexInsert
Method Name: test_insert_invalid_na