Refactor assertGivesWarning into separate methods#2863
Merged
pelson merged 2 commits intoSciTools:masterfrom Oct 27, 2017
Merged
Refactor assertGivesWarning into separate methods#2863pelson merged 2 commits intoSciTools:masterfrom
pelson merged 2 commits intoSciTools:masterfrom
Conversation
pelson
reviewed
Oct 26, 2017
Member
pelson
left a comment
There was a problem hiding this comment.
Happy conceptually. The golden problem of naming remains... 😄
| # byte type. | ||
| cube = self._make_cube('>i1') | ||
| with self.assertGivesWarning(r'\(fill\|mask\)', expect_warning=False): | ||
| with self.assertDoesNotGiveWarning(r'\(fill\|mask\)'): |
Member
There was a problem hiding this comment.
rename? assertNoWarningsMatching?
Member
There was a problem hiding this comment.
assertDoesNotGiveWarningMatchingRegexp
lib/iris/tests/__init__.py
Outdated
| if expr.search(message)) | ||
|
|
||
| @contextlib.contextmanager | ||
| def assertGivesWarning(self, expected_regexp=''): |
Member
There was a problem hiding this comment.
Or even assertGivesWarningMatchingRegexp
Member
|
On consideration, I don't like the original name. |
pelson
approved these changes
Oct 26, 2017
Member
|
Some genuine test failures... |
d190be9 to
4f8b2d8
Compare
Member
|
The failing test issue has been raised in #2875. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It's confusing that
assertGivesWarningcan be used to assert that no warning is raised. I've refactored the code into separate methods.