Skip to content

Commit

Permalink
Review changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-mo committed May 18, 2017
1 parent 1c6e551 commit cd50b4f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/iris/tests/unit/fileformats/rules/test__make_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# importing anything else.
import iris.tests as tests

import six
import warnings

from iris.fileformats.rules import ConversionMetadata
Expand Down Expand Up @@ -51,7 +52,10 @@ def test_invalid_units(self):
dim_coords_and_dims, aux_coords_and_dims)
converter = mock.Mock(return_value=metadata)

field = mock.Mock(core_data=lambda: np.arange(3.), bmdi=9999.)
data = np.arange(3.)
field = mock.Mock(core_data=lambda: data,
bmdi=9999.,
realised_dtype=data.dtype)
with warnings.catch_warnings(record=True) as warn:
warnings.simplefilter("always")
cube, factories, references = _make_cube(field, converter)
Expand All @@ -64,7 +68,7 @@ def test_invalid_units(self):
# Check warning was raised.
self.assertEqual(len(warn), 1)
exp_emsg = 'invalid units {!r}'.format(units)
self.assertRegexpMatches(str(warn[0]), exp_emsg)
six.assertRegex(self, str(warn[0]), exp_emsg)


if __name__ == "__main__":
Expand Down

0 comments on commit cd50b4f

Please sign in to comment.