summaryrefslogtreecommitdiff
path: root/numpy/ma/tests/test_extras.py
diff options
context:
space:
mode:
authorpierregm <pierregm@localhost>2009-07-18 20:03:02 +0000
committerpierregm <pierregm@localhost>2009-07-18 20:03:02 +0000
commita44e1438cc156d24bfdaa80f5007bc16f6e88418 (patch)
tree60b6661d8202b9538376bec69f2df03edd14104f /numpy/ma/tests/test_extras.py
parent4beb657e521ceeb7645dfb84f531c55b8032fa39 (diff)
downloadnumpy-a44e1438cc156d24bfdaa80f5007bc16f6e88418.tar.gz
core : fixed MaskedArray.__array_finalize__ when the mask is full of False (bugfix #1166)
extras : introduced clump_masked and clump_unmasked
Diffstat (limited to 'numpy/ma/tests/test_extras.py')
-rw-r--r--numpy/ma/tests/test_extras.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py
index 089a4e58a..687fc9b81 100644
--- a/numpy/ma/tests/test_extras.py
+++ b/numpy/ma/tests/test_extras.py
@@ -70,7 +70,24 @@ class TestGeneric(TestCase):
mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt)
test = masked_all_like(control)
assert_equal(test, control)
+
+ def test_clump_masked(self):
+ "Test clump_masked"
+ a = masked_array(np.arange(10))
+ a[[0, 1, 2, 6, 8, 9]] = masked
#
+ test = clump_masked(a)
+ control = [slice(0, 3), slice(6, 7), slice(8, 10)]
+ assert_equal(test, control)
+
+ def test_clump_unmasked(self):
+ "Test clump_unmasked"
+ a = masked_array(np.arange(10))
+ a[[0, 1, 2, 6, 8, 9]] = masked
+ test = clump_unmasked(a)
+ control = [slice(3, 6), slice(7, 8),]
+ assert_equal(test, control)
+
class TestAverage(TestCase):
@@ -151,8 +168,13 @@ class TestAverage(TestCase):
a2dma = average(a2dm, axis=1)
assert_equal(a2dma, [1.5, 4.0])
+
+
class TestConcatenator(TestCase):
- "Tests for mr_, the equivalent of r_ for masked arrays."
+ """
+ Tests for mr_, the equivalent of r_ for masked arrays.
+ """
+
def test_1d(self):
"Tests mr_ on 1D arrays."
assert_array_equal(mr_[1,2,3,4,5,6],array([1,2,3,4,5,6]))
@@ -186,7 +208,10 @@ class TestConcatenator(TestCase):
class TestNotMasked(TestCase):
- "Tests notmasked_edges and notmasked_contiguous."
+ """
+ Tests notmasked_edges and notmasked_contiguous.
+ """
+
def test_edges(self):
"Tests unmasked_edges"
data = masked_array(np.arange(25).reshape(5, 5),
@@ -222,7 +247,6 @@ class TestNotMasked(TestCase):
assert_equal(test[1], [(0, 1, 2, 4), (4, 2, 4, 4)])
-
def test_contiguous(self):
"Tests notmasked_contiguous"
a = masked_array(np.arange(24).reshape(3,8),
@@ -248,7 +272,6 @@ class TestNotMasked(TestCase):
-
class Test2DFunctions(TestCase):
"Tests 2D functions"
def test_compress2d(self):