summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-03-25 19:18:06 (GMT)
committerEric Wieser <wieser.eric@gmail.com>2018-03-25 19:18:06 (GMT)
commite2c71688e765a2c0eba4958891b0637754575f18 (patch)
treeb2feed0671851684cabafae0c06b13ff5413a2a6
parente4d678a2f5859d29a853d617e9e5bbd4b6241898 (diff)
downloadpython-numpy-e2c71688e765a2c0eba4958891b0637754575f18.zip
python-numpy-e2c71688e765a2c0eba4958891b0637754575f18.tar.gz
python-numpy-e2c71688e765a2c0eba4958891b0637754575f18.tar.bz2
TST: simplify test of notmasked_contiguous
-rw-r--r--numpy/ma/tests/test_extras.py35
1 files changed, 22 insertions, 13 deletions
diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py
index d1c1aa6..9bebd61 100644
--- a/numpy/ma/tests/test_extras.py
+++ b/numpy/ma/tests/test_extras.py
@@ -368,23 +368,32 @@ class TestNotMasked(object):
a = masked_array(np.arange(24).reshape(3, 8),
mask=[[0, 0, 0, 0, 1, 1, 1, 1],
[1, 1, 1, 1, 1, 1, 1, 1],
- [0, 0, 0, 0, 0, 0, 1, 0], ])
+ [0, 0, 0, 0, 0, 0, 1, 0]])
tmp = notmasked_contiguous(a, None)
- assert_equal(tmp[-1], slice(23, 24, None))
- assert_equal(tmp[-2], slice(16, 22, None))
- assert_equal(tmp[-3], slice(0, 4, None))
- #
+ assert_equal(tmp, [
+ slice(0, 4, None),
+ slice(16, 22, None),
+ slice(23, 24, None)
+ ])
+
tmp = notmasked_contiguous(a, 0)
- assert_(len(tmp[-1]) == 1)
- assert_(tmp[-2] is None)
- assert_equal(tmp[-3], tmp[-1])
- assert_(len(tmp[0]) == 2)
+ assert_equal(tmp, [
+ [slice(0, 1, None), slice(2, 3, None)],
+ [slice(0, 1, None), slice(2, 3, None)],
+ [slice(0, 1, None), slice(2, 3, None)],
+ [slice(0, 1, None), slice(2, 3, None)],
+ [slice(2, 3, None)],
+ [slice(2, 3, None)],
+ None,
+ [slice(2, 3, None)]
+ ])
#
tmp = notmasked_contiguous(a, 1)
- assert_equal(tmp[0][-1], slice(0, 4, None))
- assert_(tmp[1] is None)
- assert_equal(tmp[2][-1], slice(7, 8, None))
- assert_equal(tmp[2][-2], slice(0, 6, None))
+ assert_equal(tmp, [
+ [slice(0, 4, None)],
+ None,
+ [slice(0, 6, None), slice(7, 8, None)]
+ ])
class TestCompressFunctions(object):