Skip to content

Commit

Permalink
Fix ghostwriter failure caused by deferring more strategies in builds()
Browse files Browse the repository at this point in the history
  • Loading branch information
jobh committed Jul 10, 2023
1 parent 395ef47 commit 691b021
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hypothesis-python/src/hypothesis/extra/ghostwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
from hypothesis.provisional import domains
from hypothesis.strategies._internal.collections import ListStrategy
from hypothesis.strategies._internal.core import BuildsStrategy
from hypothesis.strategies._internal.deferred import DeferredStrategy
from hypothesis.strategies._internal.flatmapped import FlatMapStrategy
from hypothesis.strategies._internal.lazy import LazyStrategy, unwrap_strategies
from hypothesis.strategies._internal.strategies import (
Expand Down Expand Up @@ -668,6 +669,8 @@ def _valid_syntax_repr(strategy):
# Flatten and de-duplicate any one_of strategies, whether that's from resolving
# a Union type or combining inputs to multiple functions.
try:
if isinstance(strategy, DeferredStrategy):
strategy = strategy.wrapped_strategy
if isinstance(strategy, OneOfStrategy):
seen = set()
elems = []
Expand Down

0 comments on commit 691b021

Please sign in to comment.