-
Notifications
You must be signed in to change notification settings - Fork 295
Change behaviour of 'error' level #2881
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 all commits
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 |
---|---|---|
|
@@ -43,22 +43,30 @@ def test_invalid_attribute(self): | |
with self.assertRaises(AttributeError): | ||
future.numberwang = 7 | ||
|
||
def test_invalid_netcdf_promote_attributes(self): | ||
def test_netcdf_promote(self): | ||
future = Future() | ||
states = [True, False] | ||
exp_emsg = "deprecated 'netcdf_promote' behaviour has been removed" | ||
for state in states: | ||
with self.assertRaisesRegexp(AttributeError, exp_emsg): | ||
future.netcdf_promote = state | ||
exp_emsg = "'Future' property 'netcdf_promote' is deprecated" | ||
with self.assertWarnsRegexp(exp_emsg): | ||
future.netcdf_promote = True | ||
|
||
def test_invalid_netcdf_no_unlimited_attributes(self): | ||
def test_invalid_netcdf_promote(self): | ||
future = Future() | ||
states = [True, False] | ||
exp_emsg =\ | ||
"deprecated 'netcdf_no_unlimited' behaviour has been removed" | ||
for state in states: | ||
with self.assertRaisesRegexp(AttributeError, exp_emsg): | ||
future.netcdf_no_unlimited = state | ||
exp_emsg = "'Future' property 'netcdf_promote' has been deprecated" | ||
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. Hold on, the Future property being tested and the test name no longer match
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. This one's fine, well spotted on the other two though 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. Copy-paste mistakes are my favourite mistakes to make 😉 |
||
with self.assertRaisesRegexp(AttributeError, exp_emsg): | ||
future.netcdf_promote = False | ||
|
||
def test_netcdf_no_unlimited(self): | ||
future = Future() | ||
exp_emsg = "'Future' property 'netcdf_no_unlimited' is deprecated" | ||
with self.assertWarnsRegexp(exp_emsg): | ||
future.netcdf_no_unlimited = True | ||
|
||
def test_invalid_netcdf_no_unlimited(self): | ||
future = Future() | ||
exp_emsg = \ | ||
"'Future' property 'netcdf_no_unlimited' has been deprecated" | ||
with self.assertRaisesRegexp(AttributeError, exp_emsg): | ||
future.netcdf_no_unlimited = False | ||
|
||
def test_cell_datetime_objects(self): | ||
future = Future() | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
I don't understand the purpose of this change. If
__setattr__
has been called, there will always be avalue
. For example:This is why the test is failing, as it is testing precisely this behaviour, is being passed a value and is thus failing as this
if
block evaluates to False.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.
not False == True
...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.
I should have said
not True == False
which is the case when we don't want thisif
block to run.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.
Of course it is. That always catches me out.