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

Function test_policy_propagation

numpy/core/tests/test_mem_policy.py:273–289  ·  view source on GitHub ↗
(get_module)

Source from the content-addressed store, hash-verified

271
272@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils")
273def test_policy_propagation(get_module):
274 # The memory policy goes hand-in-hand with flags.owndata
275
276 class MyArr(np.ndarray):
277 pass
278
279 get_handler_name = np.core.multiarray.get_handler_name
280 orig_policy_name = get_handler_name()
281 a = np.arange(10).view(MyArr).reshape((2, 5))
282 assert get_handler_name(a) is None
283 assert a.flags.owndata is False
284
285 assert get_handler_name(a.base) is None
286 assert a.base.flags.owndata is False
287
288 assert get_handler_name(a.base.base) == orig_policy_name
289 assert a.base.base.flags.owndata is True
290
291
292async def concurrent_context1(get_module, orig_policy_name, event):

Callers

nothing calls this directly

Calls 3

get_handler_nameFunction · 0.85
reshapeMethod · 0.80
viewMethod · 0.45

Tested by

no test coverage detected