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

Function test_default_policy_singleton

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

Source from the content-addressed store, hash-verified

249
250@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils")
251def test_default_policy_singleton(get_module):
252 get_handler_name = np.core.multiarray.get_handler_name
253
254 # set the policy to default
255 orig_policy = get_module.set_old_policy(None)
256
257 assert get_handler_name() == 'default_allocator'
258
259 # re-set the policy to default
260 def_policy_1 = get_module.set_old_policy(None)
261
262 assert get_handler_name() == 'default_allocator'
263
264 # set the policy to original
265 def_policy_2 = get_module.set_old_policy(orig_policy)
266
267 # since default policy is a singleton,
268 # these should be the same object
269 assert def_policy_1 is def_policy_2 is get_module.get_default_policy()
270
271
272@pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils")

Callers

nothing calls this directly

Calls 1

get_handler_nameFunction · 0.85

Tested by

no test coverage detected