From 9e945840cb447dfa16bf55eb39116b75664c2c48 Mon Sep 17 00:00:00 2001 From: Peter Killick Date: Tue, 14 Mar 2017 10:04:15 +0000 Subject: [PATCH] Correct test file, reuse mask --- .../merge/ProtoCube/register__CubeSig/noise.txt | 2 +- .../unit/lazy_data/test_array_masked_to_nans.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/iris/tests/results/unit/merge/ProtoCube/register__CubeSig/noise.txt b/lib/iris/tests/results/unit/merge/ProtoCube/register__CubeSig/noise.txt index 3191fd4af6..c330646e72 100644 --- a/lib/iris/tests/results/unit/merge/ProtoCube/register__CubeSig/noise.txt +++ b/lib/iris/tests/results/unit/merge/ProtoCube/register__CubeSig/noise.txt @@ -4,4 +4,4 @@ failed to merge into a single cube. cube.attributes keys differ: 'stuffed' cube.cell_methods differ cube.shape differs: (3,) != (2,) - cube data dtype differs: int64 != float64 \ No newline at end of file + cube data dtype differs: int64 != int8 \ No newline at end of file diff --git a/lib/iris/tests/unit/lazy_data/test_array_masked_to_nans.py b/lib/iris/tests/unit/lazy_data/test_array_masked_to_nans.py index cc2d72fdd9..8f210dd495 100644 --- a/lib/iris/tests/unit/lazy_data/test_array_masked_to_nans.py +++ b/lib/iris/tests/unit/lazy_data/test_array_masked_to_nans.py @@ -36,14 +36,13 @@ def _common_checks(self, result): self.assertFalse(ma.isMaskedArray(result)) def test_masked(self): - masked_array = ma.masked_array([[1.0, 2.0], [3.0, 4.0]], - mask=[[0, 1], [0, 0]]) + mask = [[False, True], [False, False]] + masked_array = ma.masked_array([[1.0, 2.0], [3.0, 4.0]], mask=mask) result = array_masked_to_nans(masked_array) self._common_checks(result) - self.assertArrayAllClose(np.isnan(result), - [[False, True], [False, False]]) + self.assertArrayAllClose(np.isnan(result), mask) result[0, 1] = 777.7 self.assertArrayAllClose(result, [[1.0, 777.7], [3.0, 4.0]]) @@ -70,15 +69,14 @@ def test_no_mask(self): self.assertArrayAllClose(result, masked_array.data) def test_masked__integers(self): - masked_array = ma.masked_array([[1, 2], [3, 4]], - mask=[[0, 1], [0, 0]]) + mask = [[False, True], [False, False]] + masked_array = ma.masked_array([[1, 2], [3, 4]], mask=mask) result = array_masked_to_nans(masked_array) self._common_checks(result) self.assertEqual(result.dtype, np.dtype('f8')) - self.assertArrayAllClose(np.isnan(result), - [[False, True], [False, False]]) + self.assertArrayAllClose(np.isnan(result), mask) result[0, 1] = 777.7 self.assertArrayAllClose(result, [[1.0, 777.7], [3.0, 4.0]])