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

Method test_subclass

numpy/lib/tests/test_shape_base.py:141–152  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

139 assert_array_equal(result, expected)
140
141 def test_subclass(self):
142 class MinimalSubclass(np.ndarray):
143 data = 1
144
145 def minimal_function(array):
146 return array.data
147
148 a = np.zeros((6, 3)).view(MinimalSubclass)
149
150 assert_array_equal(
151 apply_along_axis(minimal_function, 0, a), np.array([1, 1, 1])
152 )
153
154 def test_scalar_array(self, cls=np.ndarray):
155 a = np.ones((6, 3)).view(cls)

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
apply_along_axisFunction · 0.90
viewMethod · 0.45

Tested by

no test coverage detected