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

Method test_broadcast

numpy/lib/tests/test_shape_base.py:99–104  ·  view source on GitHub ↗

Test that non-indexing dimensions are broadcast in both directions

(self)

Source from the content-addressed store, hash-verified

97 assert_equal(i_min, i_max)
98
99 def test_broadcast(self):
100 """ Test that non-indexing dimensions are broadcast in both directions """
101 a = np.ones((3, 4, 1))
102 ai = np.arange(10, dtype=np.intp).reshape((1, 2, 5)) % 4
103 put_along_axis(a, ai, 20, axis=1)
104 assert_equal(take_along_axis(a, ai, axis=1), 20)
105
106
107class TestApplyAlongAxis:

Callers

nothing calls this directly

Calls 4

put_along_axisFunction · 0.90
assert_equalFunction · 0.90
take_along_axisFunction · 0.90
reshapeMethod · 0.80

Tested by

no test coverage detected