Skip to content

Commit

Permalink
Adjust hypothesis strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
AVHopp committed Dec 10, 2024
1 parent 9631853 commit ab3b745
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/hypothesis_strategies/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ def numerical_targets(
"""
name = draw(target_name)
mode = draw(st.sampled_from(TargetMode))
transformation = draw(st.sampled_from(_VALID_TRANSFORMATIONS[mode]))
if bounds_strategy is None:
bounds_strategy = st_intervals(
exclude_half_bounded=True, exclude_fully_unbounded=mode is TargetMode.MATCH
exclude_half_bounded=True,
exclude_fully_unbounded=mode is TargetMode.MATCH
or transformation is not None,
)
bounds = draw(bounds_strategy)
transformation = draw(st.sampled_from(_VALID_TRANSFORMATIONS[mode]))

return NumericalTarget(
name=name, mode=mode, bounds=bounds, transformation=transformation
Expand Down

0 comments on commit ab3b745

Please sign in to comment.