()
| 484 | |
| 485 | @pytest.mark.numpy |
| 486 | def test_buffer_from_numpy(): |
| 487 | # C-contiguous |
| 488 | arr = np.arange(12, dtype=np.int8).reshape((3, 4)) |
| 489 | buf = pa.py_buffer(arr) |
| 490 | assert buf.is_cpu |
| 491 | assert buf.is_mutable |
| 492 | assert buf.to_pybytes() == arr.tobytes() |
| 493 | # F-contiguous; note strides information is lost |
| 494 | buf = pa.py_buffer(arr.T) |
| 495 | assert buf.is_cpu |
| 496 | assert buf.is_mutable |
| 497 | assert buf.to_pybytes() == arr.tobytes() |
| 498 | # Non-contiguous |
| 499 | with pytest.raises(ValueError, match="not contiguous"): |
| 500 | buf = pa.py_buffer(arr.T[::2]) |
| 501 | |
| 502 | |
| 503 | @pytest.mark.numpy |
nothing calls this directly
no outgoing calls
no test coverage detected