@@ -434,24 +434,19 @@ def test_dti_tz_localize_utc_conversion(self, tz):
434
434
with pytest .raises (pytz .NonExistentTimeError ):
435
435
rng .tz_localize (tz )
436
436
437
- @pytest .mark .parametrize ('idx' , [
438
- date_range (start = '2014-01-01' , end = '2014-12-31' , freq = 'M' ),
439
- date_range (start = '2014-01-01' , end = '2014-12-31' , freq = 'D' ),
440
- date_range (start = '2014-01-01' , end = '2014-03-01' , freq = 'H' ),
441
- date_range (start = '2014-08-01' , end = '2014-10-31' , freq = 'T' )
442
- ])
443
- def test_dti_tz_localize_roundtrip (self , tz_aware_fixture , idx ):
437
+ def test_dti_tz_localize_roundtrip (self , tz_aware_fixture ):
438
+ # note: this tz tests that a tz-naive index can be localized
439
+ # and de-localized successfully, when there are no DST transitions
440
+ # in the range.
441
+ idx = date_range (start = '2014-06-01' , end = '2014-08-30' , freq = '15T' )
444
442
tz = tz_aware_fixture
445
443
localized = idx .tz_localize (tz )
446
- expected = date_range (start = idx [0 ], end = idx [- 1 ], freq = idx .freq ,
447
- tz = tz )
448
- tm .assert_index_equal (localized , expected )
444
+ # cant localize a tz-aware object
449
445
with pytest .raises (TypeError ):
450
446
localized .tz_localize (tz )
451
-
452
447
reset = localized .tz_localize (None )
453
- tm .assert_index_equal (reset , idx )
454
448
assert reset .tzinfo is None
449
+ tm .assert_index_equal (reset , idx )
455
450
456
451
def test_dti_tz_localize_naive (self ):
457
452
rng = date_range ('1/1/2011' , periods = 100 , freq = 'H' )
0 commit comments