(get_module)
| 271 | |
| 272 | @pytest.mark.skipif(sys.version_info >= (3, 12), reason="no numpy.distutils") |
| 273 | def 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 | |
| 292 | async def concurrent_context1(get_module, orig_policy_name, event): |
nothing calls this directly
no test coverage detected