Skip to content

Commit 025becd

Browse files
jbrockmendelJulianWgs
authored andcommitted
TST: on_offset_implementations closes pandas-dev#34751 (pandas-dev#37376)
1 parent c033099 commit 025becd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pandas/tests/tseries/offsets/test_offsets_properties.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from hypothesis.extra.dateutil import timezones as dateutil_timezones
1414
from hypothesis.extra.pytz import timezones as pytz_timezones
1515
import pytest
16+
import pytz
1617

1718
import pandas as pd
1819
from pandas import Timestamp
@@ -92,7 +93,13 @@ def test_on_offset_implementations(dt, offset):
9293
# check that the class-specific implementations of is_on_offset match
9394
# the general case definition:
9495
# (dt + offset) - offset == dt
95-
compare = (dt + offset) - offset
96+
try:
97+
compare = (dt + offset) - offset
98+
except pytz.NonExistentTimeError:
99+
# dt + offset does not exist, assume(False) to indicate
100+
# to hypothesis that this is not a valid test case
101+
assume(False)
102+
96103
assert offset.is_on_offset(dt) == (compare == dt)
97104

98105

0 commit comments

Comments
 (0)