From 9a9bfe241e930d178ad1616ea55fd3d55992fb65 Mon Sep 17 00:00:00 2001 From: Rob Buckley <20515024+robbuckley@users.noreply.github.com> Date: Wed, 23 Jan 2019 20:29:02 +0000 Subject: [PATCH] TST: remove DST transition scenarios from tc #24689 --- .../tests/indexes/datetimes/test_timezones.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pandas/tests/indexes/datetimes/test_timezones.py b/pandas/tests/indexes/datetimes/test_timezones.py index 8bcc9296cb010..12c1b15733895 100644 --- a/pandas/tests/indexes/datetimes/test_timezones.py +++ b/pandas/tests/indexes/datetimes/test_timezones.py @@ -434,24 +434,19 @@ def test_dti_tz_localize_utc_conversion(self, tz): with pytest.raises(pytz.NonExistentTimeError): rng.tz_localize(tz) - @pytest.mark.parametrize('idx', [ - date_range(start='2014-01-01', end='2014-12-31', freq='M'), - date_range(start='2014-01-01', end='2014-12-31', freq='D'), - date_range(start='2014-01-01', end='2014-03-01', freq='H'), - date_range(start='2014-08-01', end='2014-10-31', freq='T') - ]) - def test_dti_tz_localize_roundtrip(self, tz_aware_fixture, idx): + def test_dti_tz_localize_roundtrip(self, tz_aware_fixture): + # note: this tz tests that a tz-naive index can be localized + # and de-localized successfully, when there are no DST transitions + # in the range. + idx = date_range(start='2014-06-01', end='2014-08-30', freq='15T') tz = tz_aware_fixture localized = idx.tz_localize(tz) - expected = date_range(start=idx[0], end=idx[-1], freq=idx.freq, - tz=tz) - tm.assert_index_equal(localized, expected) + # cant localize a tz-aware object with pytest.raises(TypeError): localized.tz_localize(tz) - reset = localized.tz_localize(None) - tm.assert_index_equal(reset, idx) assert reset.tzinfo is None + tm.assert_index_equal(reset, idx) def test_dti_tz_localize_naive(self): rng = date_range('1/1/2011', periods=100, freq='H')