Skip to content

Conversation

@Zac-HD
Copy link
Member

@Zac-HD Zac-HD commented Feb 22, 2024

Fixes #61, and a typo I spotted.

Following HypothesisWorks/hypothesis#3891 (comment), I've also defined Predicate.__repr__, so that we see e.g. Predicate(str.isascii) instead of Predicate(func=<method 'isascii' of 'str' objects>) in error messages.

@Zac-HD Zac-HD requested a review from adriangb February 22, 2024 08:10
@codecov-commenter
Copy link

codecov-commenter commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6693037) 94.76% compared to head (f965037) 94.93%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #62      +/-   ##
==========================================
+ Coverage   94.76%   94.93%   +0.16%     
==========================================
  Files           2        2              
  Lines         210      217       +7     
  Branches       30       32       +2     
==========================================
+ Hits          199      206       +7     
  Misses          9        9              
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if getattr(self.func, "__name__", "<lambda>") == "<lambda>":
return f"{self.__class__.__name__}({self.func!r})"
if isinstance(self.func, (types.MethodType, types.BuiltinMethodType)) and (
namespace := getattr(self.func.__self__, "__name__", None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work on all Python versions we support now (3.8, so I think yes). Either way this is complex enough to warrant testing, is there a test that hits this or can you add one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it's extracted from a more-complex version in Hypothesis - I'm very confident that it works, and have added a test to make sure it keeps working.

@Zac-HD Zac-HD force-pushed the fix-readme branch 3 times, most recently from 9668619 to 7433413 Compare February 22, 2024 21:00
@Zac-HD Zac-HD merged commit 59a50d1 into main Feb 22, 2024
@Zac-HD Zac-HD deleted the fix-readme branch February 22, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More examples would be helpful

4 participants