From: Jeff Reback Date: Tue, 11 Jul 2017 16:39:39 +0000 (-0400) Subject: COMPAT with dateutil 2.6.1, fixed ambiguous tz dst behavior (#16880) Needed after... X-Git-Tag: archive/raspbian/0.20.3-11+rpi1~3^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f4093cb161f7fe5dfed456065f824f291f0c1787;p=pandas.git COMPAT with dateutil 2.6.1, fixed ambiguous tz dst behavior (#16880) Needed after dateutil 2.6.0 Gbp-Pq: Name dateutil-2.6.1-fixed-ambiguous-tz-dst-be.patch --- diff --git a/ci/requirements-3.5.run b/ci/requirements-3.5.run index 43e6814e..52828b52 100644 --- a/ci/requirements-3.5.run +++ b/ci/requirements-3.5.run @@ -1,4 +1,3 @@ -python-dateutil pytz numpy=1.11.3 openpyxl diff --git a/ci/requirements-3.5.sh b/ci/requirements-3.5.sh index d0f0b818..917439a8 100644 --- a/ci/requirements-3.5.sh +++ b/ci/requirements-3.5.sh @@ -5,3 +5,7 @@ source activate pandas echo "install 35" conda install -n pandas -c conda-forge feather-format + +# pip install python-dateutil to get latest +conda remove -n pandas python-dateutil --force +pip install python-dateutil diff --git a/ci/requirements-3.6_NUMPY_DEV.run b/ci/requirements-3.6_NUMPY_DEV.run index 0aa987ba..af44f198 100644 --- a/ci/requirements-3.6_NUMPY_DEV.run +++ b/ci/requirements-3.6_NUMPY_DEV.run @@ -1,2 +1 @@ -python-dateutil pytz diff --git a/pandas/tests/tseries/test_offsets.py b/pandas/tests/tseries/test_offsets.py index 09de064c..adc6ff68 100644 --- a/pandas/tests/tseries/test_offsets.py +++ b/pandas/tests/tseries/test_offsets.py @@ -4850,7 +4850,7 @@ class TestDST(object): hrs_pre = utc_offsets['utc_offset_daylight'] hrs_post = utc_offsets['utc_offset_standard'] - if dateutil.__version__ != LooseVersion('2.6.0'): + if dateutil.__version__ < LooseVersion('2.6.0'): # buggy ambiguous behavior in 2.6.0 # GH 14621 # https://github.com/dateutil/dateutil/issues/321 @@ -4858,6 +4858,9 @@ class TestDST(object): n=3, tstart=self._make_timestamp(self.ts_pre_fallback, hrs_pre, tz), expected_utc_offset=hrs_post) + elif dateutil.__version__ > LooseVersion('2.6.0'): + # fixed, but skip the test + continue def test_springforward_plural(self): # test moving from standard to daylight savings diff --git a/pandas/tests/tseries/test_timezones.py b/pandas/tests/tseries/test_timezones.py index 97c54922..deedd535 100644 --- a/pandas/tests/tseries/test_timezones.py +++ b/pandas/tests/tseries/test_timezones.py @@ -562,8 +562,16 @@ class TestTimeZoneSupportPytz(object): tz=tz, ambiguous='infer') assert times[0] == Timestamp('2013-10-26 23:00', tz=tz, freq="H") - if dateutil.__version__ != LooseVersion('2.6.0'): - # see gh-14621 + if str(tz).startswith('dateutil'): + if dateutil.__version__ < LooseVersion('2.6.0'): + # see gh-14621 + assert times[-1] == Timestamp('2013-10-27 01:00:00+0000', + tz=tz, freq="H") + elif dateutil.__version__ > LooseVersion('2.6.0'): + # fixed ambiguous behavior + assert times[-1] == Timestamp('2013-10-27 01:00:00+0100', + tz=tz, freq="H") + else: assert times[-1] == Timestamp('2013-10-27 01:00:00+0000', tz=tz, freq="H") @@ -1256,13 +1264,18 @@ class TestTimeZones(object): assert result_pytz.value == result_dateutil.value assert result_pytz.value == 1382835600000000000 - # dateutil 2.6 buggy w.r.t. ambiguous=0 - if dateutil.__version__ != LooseVersion('2.6.0'): + if dateutil.__version__ < LooseVersion('2.6.0'): + # dateutil 2.6 buggy w.r.t. ambiguous=0 # see gh-14621 # see https://github.com/dateutil/dateutil/issues/321 assert (result_pytz.to_pydatetime().tzname() == result_dateutil.to_pydatetime().tzname()) assert str(result_pytz) == str(result_dateutil) + elif dateutil.__version__ > LooseVersion('2.6.0'): + # fixed ambiguous behavior + assert result_pytz.to_pydatetime().tzname() == 'GMT' + assert result_dateutil.to_pydatetime().tzname() == 'BST' + assert str(result_pytz) != str(result_dateutil) # 1 hour difference result_pytz = (Timestamp('2013-10-27 01:00:00')