(self)
| 73 | class TestGeneric: |
| 74 | # |
| 75 | def test_masked_all(self): |
| 76 | # Tests masked_all |
| 77 | # Standard dtype |
| 78 | test = masked_all((2,), dtype=float) |
| 79 | control = array([1, 1], mask=[1, 1], dtype=float) |
| 80 | assert_equal(test, control) |
| 81 | # Flexible dtype |
| 82 | dt = np.dtype({'names': ['a', 'b'], 'formats': ['f', 'f']}) |
| 83 | test = masked_all((2,), dtype=dt) |
| 84 | control = array([(0, 0), (0, 0)], mask=[(1, 1), (1, 1)], dtype=dt) |
| 85 | assert_equal(test, control) |
| 86 | test = masked_all((2, 2), dtype=dt) |
| 87 | control = array([[(0, 0), (0, 0)], [(0, 0), (0, 0)]], |
| 88 | mask=[[(1, 1), (1, 1)], [(1, 1), (1, 1)]], |
| 89 | dtype=dt) |
| 90 | assert_equal(test, control) |
| 91 | # Nested dtype |
| 92 | dt = np.dtype([('a', 'f'), ('b', [('ba', 'f'), ('bb', 'f')])]) |
| 93 | test = masked_all((2,), dtype=dt) |
| 94 | control = array([(1, (1, 1)), (1, (1, 1))], |
| 95 | mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt) |
| 96 | assert_equal(test, control) |
| 97 | test = masked_all((2,), dtype=dt) |
| 98 | control = array([(1, (1, 1)), (1, (1, 1))], |
| 99 | mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt) |
| 100 | assert_equal(test, control) |
| 101 | test = masked_all((1, 1), dtype=dt) |
| 102 | control = array([[(1, (1, 1))]], mask=[[(1, (1, 1))]], dtype=dt) |
| 103 | assert_equal(test, control) |
| 104 | |
| 105 | def test_masked_all_with_object_nested(self): |
| 106 | # Test masked_all works with nested array with dtype of an 'object' |
nothing calls this directly
no test coverage detected