MCPcopy Index your code
hub / github.com/numpy/numpy / test_writeable_memoryview

Function test_writeable_memoryview

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

Source from the content-addressed store, hash-verified

633
634
635def test_writeable_memoryview():
636 # The result of broadcast_arrays exports as a non-writeable memoryview
637 # because otherwise there is no good way to opt in to the new behaviour
638 # (i.e. you would need to set writeable to False explicitly).
639 # See gh-13929.
640 original = np.array([1, 2, 3])
641
642 test_cases = [((False, ), broadcast_arrays(original,)),
643 ((True, False), broadcast_arrays(0, original))]
644 for is_broadcast, results in test_cases:
645 for array_is_broadcast, result in zip(is_broadcast, results):
646 # This will change to False in a future version
647 if array_is_broadcast:
648 # memoryview(result, writable=True) will give warning but cannot
649 # be tested using the python API.
650 assert memoryview(result).readonly
651 else:
652 assert not memoryview(result).readonly
653
654
655def test_reference_types():

Callers

nothing calls this directly

Calls 1

broadcast_arraysFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…