Skip to content

Commit

Permalink
Fix inquisitor overrun
Browse files Browse the repository at this point in the history
This is rather rare, but happened
  • Loading branch information
Zac-HD committed Apr 29, 2023
1 parent 7b792ce commit b156e74
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions hypothesis-python/src/hypothesis/internal/conjecture/shrinker.py
Expand Up @@ -546,10 +546,11 @@ def explain(self):
)

# Turns out this was a variable-length part, so grab the infix...
if (
result.status == Status.OVERRUN
or len(buf_attempt_fixed) != len(result.buffer)
or not result.buffer.endswith(buffer[end:])
if result.status == Status.OVERRUN:
continue # pragma: no cover
if not (
len(buf_attempt_fixed) == len(result.buffer)
and result.buffer.endswith(buffer[end:])
):
for ex, res in zip(shrink_target.examples, result.examples):
assert ex.start == res.start
Expand Down Expand Up @@ -612,8 +613,6 @@ def explain(self):
# This *can't* be a shrink because none of the components were.
assert shrink_target is self.shrink_target
if result.status == Status.VALID:
# TODO: cover this branch.
# I might need to save or retrieve passing chunks too???
self.shrink_target.slice_comments[
(0, 0)
] = "The test sometimes passed when commented parts were varied together."
Expand Down

0 comments on commit b156e74

Please sign in to comment.