(self)
| 4883 | assert_equal(test, control) |
| 4884 | |
| 4885 | def test_compressed(self): |
| 4886 | # Test ma.compressed function. |
| 4887 | # Address gh-4026 |
| 4888 | a = np.ma.array([1, 2]) |
| 4889 | test = np.ma.compressed(a) |
| 4890 | assert_(type(test) is np.ndarray) |
| 4891 | |
| 4892 | # Test case when input data is ndarray subclass |
| 4893 | class A(np.ndarray): |
| 4894 | pass |
| 4895 | |
| 4896 | a = np.ma.array(A(shape=0)) |
| 4897 | test = np.ma.compressed(a) |
| 4898 | assert_(type(test) is A) |
| 4899 | |
| 4900 | # Test that compress flattens |
| 4901 | test = np.ma.compressed([[1],[2]]) |
| 4902 | assert_equal(test.ndim, 1) |
| 4903 | test = np.ma.compressed([[[[[1]]]]]) |
| 4904 | assert_equal(test.ndim, 1) |
| 4905 | |
| 4906 | # Test case when input is MaskedArray subclass |
| 4907 | class M(MaskedArray): |
| 4908 | pass |
| 4909 | |
| 4910 | test = np.ma.compressed(M([[[]], [[]]])) |
| 4911 | assert_equal(test.ndim, 1) |
| 4912 | |
| 4913 | # with .compressed() overridden |
| 4914 | class M(MaskedArray): |
| 4915 | def compressed(self): |
| 4916 | return 42 |
| 4917 | |
| 4918 | test = np.ma.compressed(M([[[]], [[]]])) |
| 4919 | assert_equal(test, 42) |
| 4920 | |
| 4921 | def test_convolve(self): |
| 4922 | a = masked_equal(np.arange(5), 2) |
nothing calls this directly
no test coverage detected