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

Method test_compress

numpy/core/tests/test_multiarray.py:1876–1893  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1874 assert_equal(np.any(a, where=False), False)
1875
1876 def test_compress(self):
1877 tgt = [[5, 6, 7, 8, 9]]
1878 arr = np.arange(10).reshape(2, 5)
1879 out = arr.compress([0, 1], axis=0)
1880 assert_equal(out, tgt)
1881
1882 tgt = [[1, 3], [6, 8]]
1883 out = arr.compress([0, 1, 0, 1, 0], axis=1)
1884 assert_equal(out, tgt)
1885
1886 tgt = [[1], [6]]
1887 arr = np.arange(10).reshape(2, 5)
1888 out = arr.compress([0, 1], axis=1)
1889 assert_equal(out, tgt)
1890
1891 arr = np.arange(10).reshape(2, 5)
1892 out = arr.compress([0, 1])
1893 assert_equal(out, 1)
1894
1895 def test_choose(self):
1896 x = 2*np.ones((3,), dtype=int)

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
reshapeMethod · 0.80
compressMethod · 0.80

Tested by

no test coverage detected