From 2961792f37d538d71272f229de783ec9177230bb Mon Sep 17 00:00:00 2001 From: Brock Date: Fri, 23 Oct 2020 18:11:12 -0700 Subject: [PATCH] TST: on_offset_implementations closes #34751 --- pandas/tests/tseries/offsets/test_offsets_properties.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pandas/tests/tseries/offsets/test_offsets_properties.py b/pandas/tests/tseries/offsets/test_offsets_properties.py index 0fa9081d606b0..8d9b54cf3f0df 100644 --- a/pandas/tests/tseries/offsets/test_offsets_properties.py +++ b/pandas/tests/tseries/offsets/test_offsets_properties.py @@ -13,6 +13,7 @@ from hypothesis.extra.dateutil import timezones as dateutil_timezones from hypothesis.extra.pytz import timezones as pytz_timezones import pytest +import pytz import pandas as pd from pandas import Timestamp @@ -92,7 +93,13 @@ def test_on_offset_implementations(dt, offset): # check that the class-specific implementations of is_on_offset match # the general case definition: # (dt + offset) - offset == dt - compare = (dt + offset) - offset + try: + compare = (dt + offset) - offset + except pytz.NonExistentTimeError: + # dt + offset does not exist, assume(False) to indicate + # to hypothesis that this is not a valid test case + assume(False) + assert offset.is_on_offset(dt) == (compare == dt)