|
14 | 14 | # |
15 | 15 | # You should have received a copy of the GNU Lesser General Public License |
16 | 16 | # along with Iris. If not, see <http://www.gnu.org/licenses/>. |
17 | | -"""Unit tests for the `iris.options.Paralle` class.""" |
| 17 | +"""Unit tests for the `iris.config.NetCDF` class.""" |
18 | 18 |
|
19 | 19 | from __future__ import (absolute_import, division, print_function) |
20 | 20 | from six.moves import (filter, input, map, range, zip) # noqa |
|
30 | 30 |
|
31 | 31 |
|
32 | 32 | class Test(tests.IrisTest): |
| 33 | + def setUp(self): |
| 34 | + self.options = iris.config.NetCDF() |
| 35 | + |
33 | 36 | def test_basic(self): |
34 | | - self.assertFalse(iris.config.netcdf.conventions_override) |
| 37 | + self.assertFalse(self.options.conventions_override) |
35 | 38 |
|
36 | 39 | def test_enabled(self): |
37 | | - iris.config.netcdf.conventions_override = True |
38 | | - self.assertTrue(iris.config.netcdf.conventions_override) |
| 40 | + self.options.conventions_override = True |
| 41 | + self.assertTrue(self.options.conventions_override) |
39 | 42 |
|
40 | 43 | def test_bad_value(self): |
41 | 44 | # A bad value should be ignored and replaced with the default value. |
42 | 45 | bad_value = 'wibble' |
43 | 46 | with warnings.catch_warnings(record=True) as w: |
44 | 47 | warnings.simplefilter('always') |
45 | | - iris.config.netcdf.conventions_override = bad_value |
46 | | - self.assertFalse(iris.config.netcdf.conventions_override) |
| 48 | + self.options.conventions_override = bad_value |
| 49 | + self.assertFalse(self.options.conventions_override) |
47 | 50 | exp_wmsg = 'Attempting to set invalid value {!r}'.format(bad_value) |
48 | 51 | six.assertRegex(self, str(w[0].message), exp_wmsg) |
49 | 52 |
|
50 | 53 | def test__contextmgr(self): |
51 | | - with iris.config.netcdf.context(conventions_override=True): |
52 | | - self.assertTrue(iris.config.netcdf.conventions_override) |
53 | | - self.assertFalse(iris.config.netcdf.conventions_override) |
| 54 | + with self.options.context(conventions_override=True): |
| 55 | + self.assertTrue(self.options.conventions_override) |
| 56 | + self.assertFalse(self.options.conventions_override) |
54 | 57 |
|
55 | 58 |
|
56 | 59 | if __name__ == '__main__': |
|
0 commit comments