@@ -125,7 +125,10 @@ def test_consistency_with_tz_aware_scalar(self):
125
125
126
126
def test_access_datetimeindex_with_timezoned_label (self ):
127
127
128
- idx = pd .DataFrame (index = pd .date_range ('2016-01-01T00:00' , '2016-03-31T23:59' , freq = 'T' ))
128
+ # 6785, timezone was ignored when simple string was provided as a label
129
+
130
+ idx = pd .DataFrame (index = pd .date_range ('2016-01-01T00:00' ,
131
+ '2016-03-31T23:59' , freq = 'T' ))
129
132
130
133
former_naive_endpoint_idx = idx [
131
134
"2016-01-01T00:00-02:00"
@@ -139,13 +142,20 @@ def test_access_datetimeindex_with_timezoned_label(self):
139
142
pd .Timestamp ("2016-01-01T02:03" )
140
143
]
141
144
142
- assert len (former_naive_endpoint_idx ) == len (former_non_naive_endpoint_idx )
145
+ assert (len (former_naive_endpoint_idx )
146
+ == len (former_non_naive_endpoint_idx ))
147
+
148
+ assert (former_naive_endpoint_idx .iloc [0 ].name
149
+ == former_non_naive_endpoint_idx .iloc [0 ].name )
150
+
151
+ assert (former_naive_endpoint_idx .iloc [1 ].name
152
+ == former_non_naive_endpoint_idx .iloc [1 ].name )
143
153
144
- assert former_naive_endpoint_idx .iloc [0 ].name == former_non_naive_endpoint_idx .iloc [0 ].name
145
- assert former_naive_endpoint_idx .iloc [1 ].name == former_non_naive_endpoint_idx .iloc [1 ].name
146
- assert former_naive_endpoint_idx .iloc [2 ].name == former_non_naive_endpoint_idx .iloc [2 ].name
147
- assert former_naive_endpoint_idx .iloc [3 ].name == former_non_naive_endpoint_idx .iloc [3 ].name
154
+ assert (former_naive_endpoint_idx .iloc [2 ].name
155
+ == former_non_naive_endpoint_idx .iloc [2 ].name )
148
156
157
+ assert (former_naive_endpoint_idx .iloc [3 ].name
158
+ == former_non_naive_endpoint_idx .iloc [3 ].name )
149
159
150
160
def test_indexing_with_datetimeindex_tz (self ):
151
161
0 commit comments