-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat: new mypyc primitives for str.count #19264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Looks good. Left some thoughts about additional cases to test.
string = "abcbcb" | ||
assert string.count("a", 0, 4) == 1, string.count("a", 0, 4) | ||
assert string.count("b", 0, 4) == 2, string.count("b", 0, 4) | ||
assert string.count("c", 0, 4) == 1, string.count("c", 0, 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideas for additional tests:
- Test substrings with length longer than 1.
- Test negative start/end (these appear to work).
- Test start/end that overflows (these appear to not raise an exception).
- Test unicode strings (e.g. character code larger than 127, character code larger than 255).
|
for more information, see https://pre-commit.ci
All requested tests have been added, this PR is now ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! Looks good now.
This PR adds new mypyc primitives for all variations of
str.count
fixes 1096