fix(deps): hypothesis update and text, refs #2262#2263
fix(deps): hypothesis update and text, refs #2262#2263milssky wants to merge 1 commit intodry-python:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2263 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 80 81 +1
Lines 2485 2581 +96
Branches 437 44 -393
==========================================
+ Hits 2485 2581 +96 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| assert ( | ||
| _strategy_string(result[callable_type], Callable[[int, str], bool]) | ||
| == 'functions(like=lambda *args, **kwargs: <unknown>,' | ||
| == 'functions(like=lambda *args, **kwargs: None,' |
There was a problem hiding this comment.
The question is: does this function actually return None? Or is it a repr bug?
There was a problem hiding this comment.
weirder and weirder
>>> from hypothesis.internal.lambda_sources import lambda_description
>>> lambda_description(lambda *args, **kwargs: None)
'lambda *args, **kwargs: None'
>>> lambda_description(lambda *args: None)
'lambda *args: <unknown>'
>>> lambda_description(lambda: None)
'lambda: <unknown>'I keep looking
There was a problem hiding this comment.
Looks like the repr of lambdas was changed in HypothesisWorks/hypothesis#4500. Afaics, they used to always use <unknown>, but now they refine the lambda body string where possible. I think this should be a harmless change for us.
(Found this via the changelog for 6.137.3
This patch makes the stringification of lambdas, and as a result
certain automatic filter rewriting operations, more robust. This fixes
issue https://github.com/HypothesisWorks/hypothesis/issues/4498, where a lambda was mistakenly identified as the identity
operator due to "inspect.getsource()" only returning the first line of
the lambda definition.
As a result, the "repr" of strategies filtered or mapped by lambda
functions may change slightly.
)
I have made things!
@pradeep90 hey! Your code is broken :) Can you validate it?
In hypothesis==6.137.2, this code produced the following output:
Whereas in hypothesis==6.140.2, the output is already:
So this is indeed a direct change in the library itself.
Checklist
CHANGELOG.mdRelated issues
Refs #2262
🙏 Please, if you or your company finds
dry-pythonvaluable, help us sustain the project by sponsoring it transparently on https://github.com/sponsors/dry-python. As a thank you, your profile/company logo will be added to our main README which receives hundreds of unique visitors per day.