Skip to content

Commit 91ef33e

Browse files
committed
CLN: Remove try-except in parse_dates test
1 parent 323dddc commit 91ef33e

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

pandas/tests/io/parser/parse_dates.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import pytz
1717
import pandas as pd
1818
import pandas.io.parsers as parsers
19-
import pandas.core.tools.datetimes as tools
2019
import pandas.util.testing as tm
2120

2221
import pandas.io.date_converters as conv
@@ -357,21 +356,13 @@ def test_parse_dates_custom_euroformat(self):
357356

358357
def test_parse_tz_aware(self):
359358
# See gh-1693
360-
import pytz
361359
data = StringIO("Date,x\n2012-06-13T01:39:00Z,0.5")
362360

363361
# it works
364362
result = self.read_csv(data, index_col=0, parse_dates=True)
365363
stamp = result.index[0]
366364
assert stamp.minute == 39
367-
try:
368-
assert result.index.tz is pytz.utc
369-
except AssertionError:
370-
arr = result.index.to_pydatetime()
371-
result = tools.to_datetime(arr, utc=True)[0]
372-
assert stamp.minute == result.minute
373-
assert stamp.hour == result.hour
374-
assert stamp.day == result.day
365+
assert result.index.tz is pytz.utc
375366

376367
def test_multiple_date_cols_index(self):
377368
data = """
@@ -677,6 +668,7 @@ def test_parse_date_float(self, data, expected, parse_dates):
677668
tm.assert_frame_equal(result, expected)
678669

679670
def test_parse_timezone(self):
671+
# gh-22256
680672
data = """dt,val
681673
2018-01-04 09:01:00+09:00,23350
682674
2018-01-04 09:02:00+09:00,23400

0 commit comments

Comments
 (0)