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

Function as_strided_writeable

numpy/lib/tests/test_stride_tricks.py:502–517  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

500
501
502def as_strided_writeable():
503 arr = np.ones(10)
504 view = as_strided(arr, writeable=False)
505 assert_(not view.flags.writeable)
506
507 # Check that writeable also is fine:
508 view = as_strided(arr, writeable=True)
509 assert_(view.flags.writeable)
510 view[...] = 3
511 assert_array_equal(arr, np.full_like(arr, 3))
512
513 # Test that things do not break down for readonly:
514 arr.flags.writeable = False
515 view = as_strided(arr, writeable=False)
516 view = as_strided(arr, writeable=True)
517 assert_(not view.flags.writeable)
518
519
520class VerySimpleSubClass(np.ndarray):

Callers

nothing calls this directly

Calls 3

as_stridedFunction · 0.90
assert_Function · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected