Skip to content

Commit

Permalink
Fix a repr edge case
Browse files Browse the repository at this point in the history
This was an existing bug, which our improve filter-rewriting made more common (so that it hit our tests)
  • Loading branch information
Zac-HD committed Feb 25, 2024
1 parent 52f9245 commit c9f2a85
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,10 @@ def _transform(self, element):
# Used in UniqueSampledListStrategy
for name, f in self._transformations:
if name == "map":
element = f(element)
result = f(element)
if build_context := _current_build_context.value:
build_context.record_call(result, f, [element], {})
element = result
else:
assert name == "filter"
if not f(element):
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/cover/test_custom_reprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Bar(Foo):

def test_reprs_as_created():
@given(foo=st.builds(Foo), bar=st.from_type(Bar), baz=st.none().map(Foo))
@settings(print_blob=False, max_examples=10_000)
@settings(print_blob=False, max_examples=10_000, derandomize=True)
def inner(foo, bar, baz):
assert baz.x is None
assert foo.x <= 0 or bar.x >= 0
Expand Down

0 comments on commit c9f2a85

Please sign in to comment.