412554b2f06f3782c9336f5a4dfc5bb890219afd,pandas/tests/indexing/test_coercion.py,TestInsertIndexCoercion,test_insert_index_datetimes,#TestInsertIndexCoercion#Any#Any#Any#Any#,443
Before Change
[pd.Timestamp("2012-01-01"), pd.Timestamp("2012-01-01", tz="Asia/Tokyo"), 1],
)
def test_insert_index_datetimes(self, request, fill_val, exp_dtype, insert_value):
if not hasattr(insert_value, "tz"):
request.node.add_marker(
pytest.mark.xfail(reason="ToDo: must coerce to object")
)
elif fill_val.tz != insert_value.tz:
request.node.add_marker(
pytest.mark.xfail(reason="GH 37605 - require tz equality?")
)
obj = pd.DatetimeIndex(
["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"], tz=fill_val.tz
)
assert obj.dtype == exp_dtype
After Change
)
self._assert_insert_conversion(obj, fill_val, exp, exp_dtype)
if fill_val.tz:
// mismatched tzawareness
ts = pd.Timestamp("2012-01-01")
result = obj.insert(1, ts)
expected = obj.astype(object).insert(1, ts)
assert expected.dtype == object
tm.assert_index_equal(result, expected)
// mismatched tz --> cast to object (could reasonably cast to commom tz)
ts = pd.Timestamp("2012-01-01", tz="Asia/Tokyo")
result = obj.insert(1, ts)
expected = obj.astype(object).insert(1, ts)
assert expected.dtype == object
tm.assert_index_equal(result, expected)
else:
// mismatched tzawareness
ts = pd.Timestamp("2012-01-01", tz="Asia/Tokyo")
result = obj.insert(1, ts)
expected = obj.astype(object).insert(1, ts)
assert expected.dtype == object
tm.assert_index_equal(result, expected)
item = 1
result = obj.insert(1, item)
expected = obj.astype(object).insert(1, item)
assert expected[1] == item
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: pandas-dev/pandas
Commit Name: 412554b2f06f3782c9336f5a4dfc5bb890219afd
Time: 2021-01-21
Author: jbrockmendel@gmail.com
File Name: pandas/tests/indexing/test_coercion.py
Class Name: TestInsertIndexCoercion
Method Name: test_insert_index_datetimes
Project Name: pandas-dev/pandas
Commit Name: 56f03c79e3c4715d4bcd054af7033b96fd8c0f1c
Time: 2020-10-17
Author: jbrockmendel@gmail.com
File Name: pandas/tests/arithmetic/test_timedelta64.py
Class Name: TestTimedeltaArraylikeMulDivOps
Method Name: test_td64arr_mod_tdscalar
Project Name: probcomp/bayeslite
Commit Name: 9e87fc512225b71e89249f2a65179d8caf20811a
Time: 2015-06-05
Author: riastradh+probcomp@csail.mit.edu
File Name: tests/test_core.py
Class Name:
Method Name: test_row_similarity