Skip to content

Commit ff76e49

Browse files
committed
Start to address tests
1 parent 51dfbe7 commit ff76e49

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

pandas/tests/indexes/datetimes/test_timezones.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,8 @@ def test_dti_tz_nat(self, tzstr):
184184
assert isna(idx[1])
185185
assert idx[0].tzinfo is not None
186186

187-
@pytest.mark.parametrize("tzstr", ["pytz/US/Eastern", "dateutil/US/Eastern"])
187+
@pytest.mark.parametrize("tzstr", ["US/Eastern", "dateutil/US/Eastern"])
188188
def test_utc_box_timestamp_and_localize(self, tzstr):
189-
if tzstr.startswith("pytz/"):
190-
pytest.importorskip("pytz")
191-
tzstr = tzstr.removeprefix("pytz/")
192189
tz = timezones.maybe_get_tz(tzstr)
193190

194191
rng = date_range("3/11/2012", "3/12/2012", freq="h", tz="utc")
@@ -203,11 +200,10 @@ def test_utc_box_timestamp_and_localize(self, tzstr):
203200
# right tzinfo
204201
rng = date_range("3/13/2012", "3/14/2012", freq="h", tz="utc")
205202
rng_eastern = rng.tz_convert(tzstr)
206-
# test not valid for dateutil timezones.
207-
# assert 'EDT' in repr(rng_eastern[0].tzinfo)
208-
assert "EDT" in repr(rng_eastern[0].tzinfo) or "tzfile" in repr(
209-
rng_eastern[0].tzinfo
210-
)
203+
if "dateutil" in tzstr:
204+
assert "EDT" in repr(rng_eastern[0].tzinfo) or "tzfile" in repr(
205+
rng_eastern[0].tzinfo
206+
)
211207

212208
@pytest.mark.parametrize(
213209
"tz", [zoneinfo.ZoneInfo("US/Central"), gettz("US/Central")]

pandas/tests/tseries/offsets/test_dst.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ def test_all_offset_classes(self, tup):
256256
],
257257
)
258258
def test_nontick_offset_with_ambiguous_time_error(original_dt, target_dt, offset, tz):
259-
# .apply for non-Tick offsets throws AmbiguousTimeError when the target dt
259+
# .apply for non-Tick offsets throws ValueError when the target dt
260260
# is dst-ambiguous
261-
localized_dt = original_dt.tz_localize(pytz.timezone(tz))
261+
localized_dt = original_dt.tz_localize(tz)
262262

263263
msg = f"Cannot infer dst time from {target_dt}, try using the 'ambiguous' argument"
264-
with pytest.raises(pytz.AmbiguousTimeError, match=msg):
264+
with pytest.raises(ValueError, match=msg):
265265
localized_dt + offset

0 commit comments

Comments
 (0)