-
Notifications
You must be signed in to change notification settings - Fork 316
Refactor assertGivesWarning into separate methods #2863
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -440,7 +440,7 @@ def test_contains_default_fill_value_byte(self): | |
| # value if no fill_value argument is supplied when the data is of a | ||
| # 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @djkirkham suggests:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| with self._netCDF_var(cube): | ||
| pass | ||
|
|
||
|
|
@@ -449,15 +449,15 @@ def test_contains_masked_fill_value(self): | |
| # a masked point. | ||
| fill_value = 1 | ||
| cube = self._make_cube('>f4', masked_value=fill_value) | ||
| with self.assertGivesWarning(r'\(fill\|mask\)', expect_warning=False): | ||
| with self.assertDoesNotGiveWarning(r'\(fill\|mask\)'): | ||
| with self._netCDF_var(cube, fill_value=fill_value): | ||
| pass | ||
|
|
||
| def test_masked_byte_default_fill_value(self): | ||
| # Test that a warning is raised when saving masked byte data with no | ||
| # fill value supplied. | ||
| cube = self._make_cube('>i1', masked_value=1) | ||
| with self.assertGivesWarning(r'\(fill\|mask\)', expect_warning=False): | ||
| with self.assertDoesNotGiveWarning(r'\(fill\|mask\)'): | ||
| with self._netCDF_var(cube): | ||
| pass | ||
|
|
||
|
|
@@ -466,7 +466,7 @@ def test_masked_byte_fill_value_passed(self): | |
| # fill value supplied if the the data does not contain the fill_value. | ||
| fill_value = 100 | ||
| cube = self._make_cube('>i1', masked_value=2) | ||
| with self.assertGivesWarning(r'\(fill\|mask\)', expect_warning=False): | ||
| with self.assertDoesNotGiveWarning(r'\(fill\|mask\)'): | ||
| with self._netCDF_var(cube, fill_value=fill_value): | ||
| pass | ||
|
|
||
|
|
||
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.
rename?
assertWarningsMatching?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.
@djkirkham suggests:
assertGivesWarningRegexpThere 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.
Or even
assertGivesWarningMatchingRegexp