MCPcopy Index your code
hub / github.com/numpy/numpy / test_compress

Method test_compress

numpy/_core/tests/test_multiarray.py:2101–2118  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2099 assert arr.all(dtype=object, keepdims=True).dtype == object
2100
2101 def test_compress(self):
2102 tgt = [[5, 6, 7, 8, 9]]
2103 arr = np.arange(10).reshape(2, 5)
2104 out = arr.compress([0, 1], axis=0)
2105 assert_equal(out, tgt)
2106
2107 tgt = [[1, 3], [6, 8]]
2108 out = arr.compress([0, 1, 0, 1, 0], axis=1)
2109 assert_equal(out, tgt)
2110
2111 tgt = [[1], [6]]
2112 arr = np.arange(10).reshape(2, 5)
2113 out = arr.compress([0, 1], axis=1)
2114 assert_equal(out, tgt)
2115
2116 arr = np.arange(10).reshape(2, 5)
2117 out = arr.compress([0, 1])
2118 assert_equal(out, 1)
2119
2120 def test_choose(self):
2121 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