Skip to content

Commit 69b517e

Browse files
author
Marvin Kastner
committed
Make test_access_datetimeindex_with_timezoned_label PEP08 compliant.
1 parent 2297833 commit 69b517e

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

pandas/tests/indexing/test_datetime.py

+16-6
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ def test_consistency_with_tz_aware_scalar(self):
125125

126126
def test_access_datetimeindex_with_timezoned_label(self):
127127

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'))
129132

130133
former_naive_endpoint_idx = idx[
131134
"2016-01-01T00:00-02:00"
@@ -139,13 +142,20 @@ def test_access_datetimeindex_with_timezoned_label(self):
139142
pd.Timestamp("2016-01-01T02:03")
140143
]
141144

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)
143153

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)
148156

157+
assert (former_naive_endpoint_idx.iloc[3].name
158+
== former_non_naive_endpoint_idx.iloc[3].name)
149159

150160
def test_indexing_with_datetimeindex_tz(self):
151161

0 commit comments

Comments
 (0)