-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
unittest.TestCase.assertRegex should allow bytes #2312
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
Comments
That should be an easy fix using generics, right? Can you submit a PR? |
You may run into python/mypy#3644 though. In that case, you'll need to use overloads instead (one for bytes and one for str). |
Sure, will give it a try next week. |
And also in assertNotRegex, assertRegexpMatches. Closes python#2312.
I've submitted a PR. I gave it a quick test and didn't see any problems like #3644. The error messages in cases where one mixed bytes with str aren't the most informative ( |
And also in assertNotRegex, assertRegexpMatches. Closes #2312.
And also in assertNotRegex, assertRegexpMatches. Closes python#2312.
The annotation for unittest.TestCase.assertRegex is currently
However, it's also legal to use
bytes
, as long as bothtext
andregex
are bytes. This also affects assertNotRegex and assertRegexpMatches.The text was updated successfully, but these errors were encountered: