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

Method test_scalar_interface

numpy/_core/tests/test_multiarray.py:9656–9671  ·  view source on GitHub ↗
(self, val, iface, expected)

Source from the content-addressed store, hash-verified

9654 reason="test result depends on the reference count of a global object",
9655 )
9656 def test_scalar_interface(self, val, iface, expected):
9657 # Test scalar coercion within the array interface
9658 self.f.iface = {'typestr': 'f8'}
9659 self.f.iface.update(iface)
9660 if HAS_REFCOUNT:
9661 pre_cnt = sys.getrefcount(np.dtype('f8'))
9662 if isinstance(expected, type):
9663 assert_raises(expected, np.array, val)
9664 else:
9665 result = np.array(val)
9666 assert_equal(np.array(val), expected)
9667 assert result.dtype == 'f8'
9668 del result
9669 if HAS_REFCOUNT:
9670 post_cnt = sys.getrefcount(np.dtype('f8'))
9671 assert_equal(pre_cnt, post_cnt)
9672
9673
9674def test_interface_empty_shape():

Callers

nothing calls this directly

Calls 4

assert_raisesFunction · 0.90
assert_equalFunction · 0.90
updateMethod · 0.80
dtypeMethod · 0.45

Tested by

no test coverage detected