Skip to content

Commit 08378fa

Browse files
committed
Exclude invalid stateful rules faster
1 parent 09308df commit 08378fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hypothesis-python/src/hypothesis/stateful.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,10 @@ def rule_is_enabled(r):
10041004
return (rule, arguments)
10051005

10061006
def is_valid(self, rule):
1007+
for b in rule.bundles:
1008+
if not self.machine.bundle(b.name):
1009+
return False
1010+
10071011
predicates = self.machine._observability_predicates
10081012
desc = f"{self.machine.__class__.__qualname__}, rule {rule.function.__name__},"
10091013
for pred in rule.preconditions:
@@ -1013,8 +1017,4 @@ def is_valid(self, rule):
10131017
if not meets_precond:
10141018
return False
10151019

1016-
for b in rule.bundles:
1017-
bundle = self.machine.bundle(b.name)
1018-
if not bundle:
1019-
return False
10201020
return True

0 commit comments

Comments
 (0)