()
| 633 | |
| 634 | |
| 635 | def 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 | |
| 655 | def test_reference_types(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…