diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-03-25 12:18:06 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-03-25 12:18:06 -0700 |
commit | e2c71688e765a2c0eba4958891b0637754575f18 (patch) | |
tree | b2feed0671851684cabafae0c06b13ff5413a2a6 | |
parent | e4d678a2f5859d29a853d617e9e5bbd4b6241898 (diff) | |
download | python-numpy-e2c71688e765a2c0eba4958891b0637754575f18.tar.gz python-numpy-e2c71688e765a2c0eba4958891b0637754575f18.tar.bz2 python-numpy-e2c71688e765a2c0eba4958891b0637754575f18.zip |
TST: simplify test of notmasked_contiguous
-rw-r--r-- | numpy/ma/tests/test_extras.py | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py index d1c1aa63e..9bebd6145 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): |