@@ -552,8 +552,16 @@ def f():
552552 tz = tz , ambiguous = 'infer' )
553553 assert times [0 ] == Timestamp ('2013-10-26 23:00' , tz = tz , freq = "H" )
554554
555- if dateutil .__version__ != LooseVersion ('2.6.0' ):
556- # see gh-14621
555+ if str (tz ).startswith ('dateutil' ):
556+ if dateutil .__version__ < LooseVersion ('2.6.0' ):
557+ # see gh-14621
558+ assert times [- 1 ] == Timestamp ('2013-10-27 01:00:00+0000' ,
559+ tz = tz , freq = "H" )
560+ elif dateutil .__version__ > LooseVersion ('2.6.0' ):
561+ # fixed ambiguous behavior
562+ assert times [- 1 ] == Timestamp ('2013-10-27 01:00:00+0100' ,
563+ tz = tz , freq = "H" )
564+ else :
557565 assert times [- 1 ] == Timestamp ('2013-10-27 01:00:00+0000' ,
558566 tz = tz , freq = "H" )
559567
@@ -1233,13 +1241,18 @@ def test_ambiguous_compat(self):
12331241 assert result_pytz .value == result_dateutil .value
12341242 assert result_pytz .value == 1382835600000000000
12351243
1236- # dateutil 2.6 buggy w.r.t. ambiguous=0
1237- if dateutil . __version__ != LooseVersion ( ' 2.6.0' ):
1244+ if dateutil . __version__ < LooseVersion ( ' 2.6.0' ):
1245+ # dateutil 2.6 buggy w.r.t. ambiguous=0
12381246 # see gh-14621
12391247 # see https://github.com/dateutil/dateutil/issues/321
12401248 assert (result_pytz .to_pydatetime ().tzname () ==
12411249 result_dateutil .to_pydatetime ().tzname ())
12421250 assert str (result_pytz ) == str (result_dateutil )
1251+ elif dateutil .__version__ > LooseVersion ('2.6.0' ):
1252+ # fixed ambiguous behavior
1253+ assert result_pytz .to_pydatetime ().tzname () == 'GMT'
1254+ assert result_dateutil .to_pydatetime ().tzname () == 'BST'
1255+ assert str (result_pytz ) != str (result_dateutil )
12431256
12441257 # 1 hour difference
12451258 result_pytz = (Timestamp ('2013-10-27 01:00:00' )
0 commit comments