Skip to content

Commit 57b3c17

Browse files
Call super().__init__() in st.SearchStrategy subclasses (pydata#10543)
In the next version of `hypothesis` subclasses of `hypothesis.strategies.SearchStrategy` will be required to call `super().__init__()` in their `__init__` method (HypothesisWorks/hypothesis#4473). This PR addresses this in the two subclasses in our codebase: `CFTimeStrategy` and `CFTimeStrategyISO8601`. Apparently this kind of subclassing is not actually part of the public API ([link](https://github.com/HypothesisWorks/hypothesis/pull/4473/files#diff-9abc0311b216f25f0b71cfff6b7043b22071d09a58cb949f6bc5022ddeaa8e7f)), so maybe we should adjust the approach here long term, but this at least gets the tests passing for now. - [x] Closes pydata#10541
1 parent 699d895 commit 57b3c17

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

xarray/testing/strategies.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ def unique_subset_of(
479479

480480
class CFTimeStrategy(st.SearchStrategy):
481481
def __init__(self, min_value, max_value):
482+
super().__init__()
482483
self.min_value = min_value
483484
self.max_value = max_value
484485

@@ -495,6 +496,7 @@ class CFTimeStrategyISO8601(st.SearchStrategy):
495496
def __init__(self):
496497
from xarray.tests.test_coding_times import _all_cftime_date_types
497498

499+
super().__init__()
498500
self.date_types = _all_cftime_date_types()
499501
self.calendars = list(self.date_types)
500502

0 commit comments

Comments
 (0)