MCPcopy Create free account
hub / github.com/numpy/numpy / test_flatten_mask

Method test_flatten_mask

numpy/ma/tests/test_core.py:4845–4861  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4843 assert_equal(mask_or(amask, bmask), cntrl)
4844
4845 def test_flatten_mask(self):
4846 # Tests flatten mask
4847 # Standard dtype
4848 mask = np.array([0, 0, 1], dtype=bool)
4849 assert_equal(flatten_mask(mask), mask)
4850 # Flexible dtype
4851 mask = np.array([(0, 0), (0, 1)], dtype=[('a', bool), ('b', bool)])
4852 test = flatten_mask(mask)
4853 control = np.array([0, 0, 0, 1], dtype=bool)
4854 assert_equal(test, control)
4855
4856 mdtype = [('a', bool), ('b', [('ba', bool), ('bb', bool)])]
4857 data = [(0, (0, 0)), (0, (0, 1))]
4858 mask = np.array(data, dtype=mdtype)
4859 test = flatten_mask(mask)
4860 control = np.array([0, 0, 0, 0, 0, 1], dtype=bool)
4861 assert_equal(test, control)
4862
4863 def test_on_ndarray(self):
4864 # Test functions on ndarrays

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
flatten_maskFunction · 0.90

Tested by

no test coverage detected