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

Class TestArray

numpy/core/tests/test_multiarray.py:6416–6424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6414
6415 def test_subclass(self):
6416 class TestArray(np.ndarray):
6417 def __new__(cls, data, info):
6418 result = np.array(data)
6419 result = result.view(cls)
6420 result.info = info
6421 return result
6422
6423 def __array_finalize__(self, obj):
6424 self.info = getattr(obj, "info", '')
6425
6426 dat = TestArray([[1, 2, 3, 4], [5, 6, 7, 8]], 'jubba')
6427 res = dat.mean(1)

Callers 1

test_subclassMethod · 0.70

Calls

no outgoing calls

Tested by 1

test_subclassMethod · 0.56