-
Notifications
You must be signed in to change notification settings - Fork 258
Specific asserts #205
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
Specific asserts #205
Conversation
Also makes use of 'self.assertIsSubclass' and 'self.assertNotIsSubclass' rather than 'assert issubclass' and 'assert not issubclass'
s/assert isinstance/self.assertIsInstance/ s/assert not isinstance/self.assertNotIsInstance/
I would actually prefer going the other way -- change the remaining Does anyone routinely run the stdlib tests with -O? |
Does anyone routinely run the stdlib tests with -O?
Not that I know of currently, but I would like for there to be buildbots
running with both -O and -OO, which should be easily doable if I rewrite
the build master as I recently mentioned on python-dev.
|
@@ -20,6 +20,25 @@ | |||
import typing | |||
|
|||
|
|||
class TestCase(_TestCase): | |||
|
|||
# vanilla TestCase doesn't have assert*Subclass, see bugs.python.org/14819 |
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.
Looks like it's not going to happen any time soon. I propose not to count on it. The rename dance TestCase -> _TestCase feels kind of awkward -- why not just pick a decent new name for TestCase + assert[Not]IsSubclass, and use that where it's needed.
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.
Right, the comment was not meant to imply that assertIsSubclass
would eventually be a standard feature. The rename dance was an effort to avoid churn, but as you pointed out, the whole PR is pretty much churn so I'll just change it to BaseTestCase.
OK, I concede your point (even though I don't like noisy commits -- you will end up owning all those lines in hg/git blame forever). Once this is merged here, can you take care of merging it into 3.5+3.6? |
My ownership of the lines is unfortunate, agreed. Yes, I can sync |
Note that, once #136 is resolved, most |
OK, go ahead and merge into CPython 3.5 and 3.6. |
Thanks, Guido. I've merged into cpython 3.5 and default. The only remaining question is whether you want |
Yea, please do the python2/test_typing.py -- I do try to keep them in sync. And there are plenty of PRs coming up. |
This PR converts the tests from simple
assert
statements toTestCase.assert*
calls. This ensures that the tests actually test something even if Python is run with -O, and makes the tests fit the style of the rest of the standard library tests.Most of the changes were made by simple
s/assert .../self.assert.../
replacements, with a few manual touchups.