(get_module)
| 249 | |
| 250 | @pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") |
| 251 | def 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") |
nothing calls this directly
no test coverage detected