Skip to content

Commit 281137d

Browse files
committed
Add test that fails only when to_datetime gets cache=True
1 parent 9555ac3 commit 281137d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tests/indexes/datetimes/test_tools.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,19 @@ def test_to_datetime_tz(self, cache):
469469
with pytest.raises(ValueError, match=msg):
470470
pd.to_datetime(arr, cache=cache)
471471

472+
473+
@pytest.mark.parametrize('cache', [True, False])
474+
def test_to_datetime_offset(self, cache):
475+
# inspired by asv timeseries.ToDatetimeNONISO8601 benchmark
476+
# see GH-26097 for more
477+
ts_string_1 = 'March 1, 2018 12:00:00+0400'
478+
ts_string_2 = 'March 1, 2018 12:00:00+0500'
479+
arr = [ts_string_1] * 5 + [ts_string_2] * 5
480+
expected = pd.Index([parse(x) for x in arr])
481+
result = pd.to_datetime(arr, cache=cache)
482+
tm.assert_index_equal(result, expected)
483+
484+
472485
@pytest.mark.parametrize('cache', [True, False])
473486
def test_to_datetime_tz_pytz(self, cache):
474487
# see gh-8260

0 commit comments

Comments
 (0)