Skip to content

Commit

Permalink
support multiple ir_types in ir_nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
tybug committed Jan 8, 2025
1 parent 85c823a commit 4348fa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions hypothesis-python/tests/conjecture/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,11 @@ def draw_value(ir_type, kwargs):


@st.composite
def ir_nodes(draw, *, was_forced=None, ir_type=None):
if ir_type is None:
def ir_nodes(draw, *, was_forced=None, ir_types=None):
if ir_types is None:
(ir_type, kwargs) = draw(ir_types_and_kwargs())
else:
ir_type = draw(st.sampled_from(ir_types))
kwargs = draw(kwargs_strategy(ir_type))
# ir nodes don't include forced in their kwargs. see was_forced attribute
del kwargs["forced"]
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/conjecture/test_data_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def _draw(data, node, *, forced=None):
return getattr(data, f"draw_{node.ir_type}")(**node.kwargs, forced=forced)


@given(ir_nodes(was_forced=True, ir_type="float"))
@given(ir_nodes(was_forced=True, ir_types=["float"]))
def test_simulate_forced_floats(node):
tree = DataTree()

Expand Down

0 comments on commit 4348fa7

Please sign in to comment.