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

Function test_writeable_memoryview

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

Source from the content-addressed store, hash-verified

617
618
619def test_writeable_memoryview():
620 # The result of broadcast_arrays exports as a non-writeable memoryview
621 # because otherwise there is no good way to opt in to the new behaviour
622 # (i.e. you would need to set writeable to False explicitly).
623 # See gh-13929.
624 original = np.array([1, 2, 3])
625
626 for is_broadcast, results in [(False, broadcast_arrays(original,)),
627 (True, broadcast_arrays(0, original))]:
628 for result in results:
629 # This will change to False in a future version
630 if is_broadcast:
631 # memoryview(result, writable=True) will give warning but cannot
632 # be tested using the python API.
633 assert memoryview(result).readonly
634 else:
635 assert not memoryview(result).readonly
636
637
638def test_reference_types():

Callers

nothing calls this directly

Calls 1

broadcast_arraysFunction · 0.90

Tested by

no test coverage detected