@@ -552,8 +552,16 @@ def f():
552
552
tz = tz , ambiguous = 'infer' )
553
553
assert times [0 ] == Timestamp ('2013-10-26 23:00' , tz = tz , freq = "H" )
554
554
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 :
557
565
assert times [- 1 ] == Timestamp ('2013-10-27 01:00:00+0000' ,
558
566
tz = tz , freq = "H" )
559
567
@@ -1233,13 +1241,18 @@ def test_ambiguous_compat(self):
1233
1241
assert result_pytz .value == result_dateutil .value
1234
1242
assert result_pytz .value == 1382835600000000000
1235
1243
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
1238
1246
# see gh-14621
1239
1247
# see https://github.com/dateutil/dateutil/issues/321
1240
1248
assert (result_pytz .to_pydatetime ().tzname () ==
1241
1249
result_dateutil .to_pydatetime ().tzname ())
1242
1250
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 )
1243
1256
1244
1257
# 1 hour difference
1245
1258
result_pytz = (Timestamp ('2013-10-27 01:00:00' )
0 commit comments