Skip to content

Commit a5a699d

Browse files
committed
Change behaviour of 'error' level
1 parent e794a1c commit a5a699d

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

lib/iris/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def __repr__(self):
224224
def __setattr__(self, name, value):
225225
if name in self.deprecated_options:
226226
level = self.deprecated_options[name]
227-
if level == 'error':
227+
if level == 'error' and not value:
228228
emsg = ("setting the 'Future' property {prop!r} has been "
229229
"deprecated to be removed in a future release, and "
230230
"deprecated {prop!r} behaviour has been removed. "

lib/iris/tests/unit/test_Future.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,17 @@ def test_invalid_attribute(self):
4343
with self.assertRaises(AttributeError):
4444
future.numberwang = 7
4545

46-
def test_invalid_netcdf_promote_attributes(self):
46+
def test_netcdf_promote(self):
4747
future = Future()
48-
states = [True, False]
49-
exp_emsg = "deprecated 'netcdf_promote' behaviour has been removed"
50-
for state in states:
51-
with self.assertRaisesRegexp(AttributeError, exp_emsg):
52-
future.netcdf_promote = state
48+
exp_emsg = "'Future' property 'netcdf_promote' is deprecated"
49+
with self.assertWarnsRegexp(exp_emsg):
50+
future.netcdf_promote = True
5351

54-
def test_invalid_netcdf_no_unlimited_attributes(self):
52+
def test_invalid_netcdf_promote(self):
5553
future = Future()
56-
states = [True, False]
57-
exp_emsg =\
58-
"deprecated 'netcdf_no_unlimited' behaviour has been removed"
59-
for state in states:
60-
with self.assertRaisesRegexp(AttributeError, exp_emsg):
61-
future.netcdf_no_unlimited = state
54+
exp_emsg = "'Future' property 'netcdf_promote' has been deprecated"
55+
with self.assertRaisesRegexp(AttributeError, exp_emsg):
56+
future.netcdf_promote = False
6257

6358
def test_cell_datetime_objects(self):
6459
future = Future()

0 commit comments

Comments
 (0)