Skip to content

Commit 8888cfc

Browse files
committed
use node.index in minimize_floats
1 parent c007798 commit 8888cfc

File tree

1 file changed

+2
-3
lines changed
  • hypothesis-python/src/hypothesis/internal/conjecture

1 file changed

+2
-3
lines changed

hypothesis-python/src/hypothesis/internal/conjecture/shrinker.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,6 @@ def minimize_floats(self, chooser):
12181218
and not is_simple(node.value),
12191219
)
12201220

1221-
i = self.nodes.index(node)
12221221
# the Float shrinker was only built to handle positive floats. We'll
12231222
# shrink the positive portion and reapply the sign after, which is
12241223
# equivalent to this shrinker's previous behavior. We'll want to refactor
@@ -1228,9 +1227,9 @@ def minimize_floats(self, chooser):
12281227
Float.shrink(
12291228
abs(node.value),
12301229
lambda val: self.consider_new_tree(
1231-
self.nodes[:i]
1230+
self.nodes[: node.index]
12321231
+ [node.copy(with_value=sign * val)]
1233-
+ self.nodes[i + 1 :]
1232+
+ self.nodes[node.index + 1 :]
12341233
),
12351234
random=self.random,
12361235
node=node,

0 commit comments

Comments
 (0)