MCPcopy
hub / github.com/numpy/numpy / test_stack_1d

Method test_stack_1d

numpy/ma/tests/test_extras.py:1868–1884  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1866class TestStack:
1867
1868 def test_stack_1d(self):
1869 a = masked_array([0, 1, 2], mask=[0, 1, 0])
1870 b = masked_array([9, 8, 7], mask=[1, 0, 0])
1871
1872 c = stack([a, b], axis=0)
1873 assert_equal(c.shape, (2, 3))
1874 assert_array_equal(a.mask, c[0].mask)
1875 assert_array_equal(b.mask, c[1].mask)
1876
1877 d = vstack([a, b])
1878 assert_array_equal(c.data, d.data)
1879 assert_array_equal(c.mask, d.mask)
1880
1881 c = stack([a, b], axis=1)
1882 assert_equal(c.shape, (3, 2))
1883 assert_array_equal(a.mask, c[:, 0].mask)
1884 assert_array_equal(b.mask, c[:, 1].mask)
1885
1886 def test_stack_masks(self):
1887 a = masked_array([0, 1, 2], mask=True)

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
assert_array_equalFunction · 0.90
stackFunction · 0.85
vstackFunction · 0.85

Tested by

no test coverage detected