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

Method test_subclass

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

Source from the content-addressed store, hash-verified

7383 assert_equal(np.std(a, where=False), np.nan)
7384
7385 def test_subclass(self):
7386 class TestArray(np.ndarray):
7387 def __new__(cls, data, info):
7388 result = np.array(data)
7389 result = result.view(cls)
7390 result.info = info
7391 return result
7392
7393 def __array_finalize__(self, obj):
7394 self.info = getattr(obj, "info", '')
7395
7396 dat = TestArray([[1, 2, 3, 4], [5, 6, 7, 8]], 'jubba')
7397 res = dat.mean(1)
7398 assert_(res.info == dat.info)
7399 res = dat.std(1)
7400 assert_(res.info == dat.info)
7401 res = dat.var(1)
7402 assert_(res.info == dat.info)
7403
7404
7405class TestVdot:

Callers

nothing calls this directly

Calls 5

assert_Function · 0.90
TestArrayClass · 0.70
meanMethod · 0.45
stdMethod · 0.45
varMethod · 0.45

Tested by

no test coverage detected