Skip to content

Commit

Permalink
Merge pull request #2137 from HypothesisWorks/DRMacIver/clean-up-engine
Browse files Browse the repository at this point in the history
Clean up core test case generation logic
  • Loading branch information
DRMacIver committed Oct 27, 2019
2 parents 591c4ca + 1f6535a commit a5d29b5
Show file tree
Hide file tree
Showing 19 changed files with 512 additions and 599 deletions.
18 changes: 18 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
RELEASE_TYPE: minor

This release significantly simplifies Hypothesis's internal logic for data
generation, by removing a number of heuristics of questionable or unproven
value.

The results of this change will vary significantly from test to test. Most
test suites will see significantly faster data generation and lower memory
usage. The "quality" of the generated data may go up or down depending on your
particular test suites.

If you see any significant regressions in Hypothesis's ability to find bugs in
your code as a result of this release, please file an issue to let us know.

Users of the new :ref:`targeted property-based testing <targeted-search>`
functionality are reasonably likely to see *improvements* in data generation,
as this release changes the search algorithm for targeted property based
testing to one that is more likely to be productive than the existing approach.
11 changes: 2 additions & 9 deletions hypothesis-python/src/hypothesis/internal/conjecture/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ class ConjectureResult(object):
output = attr.ib()
extra_information = attr.ib()
has_discards = attr.ib()
target_observations = attr.ib()
forced_indices = attr.ib(repr=False)
examples = attr.ib(repr=False)

Expand Down Expand Up @@ -800,6 +801,7 @@ def as_result(self):
if self.extra_information.has_information()
else None,
has_discards=self.has_discards,
target_observations=self.target_observations,
forced_indices=self.forced_indices,
)
self.blocks.transfer_ownership(self.__result)
Expand Down Expand Up @@ -967,15 +969,6 @@ def draw_bits(self, n, forced=None):
assert bit_length(result) <= n
return result

@property
def block_starts(self):
while self.__block_starts_calculated_to < len(self.blocks):
i = self.__block_starts_calculated_to
self.__block_starts_calculated_to += 1
u, v = self.blocks.bounds(i)
self.__block_starts[v - u].append(u)
return self.__block_starts

def draw_bytes(self, n):
"""Draw n bytes from the underlying source."""
return int_to_bytes(self.draw_bits(8 * n), n)
Expand Down

0 comments on commit a5d29b5

Please sign in to comment.