()
| 46 | |
| 47 | |
| 48 | def test_tensor_to_np(): |
| 49 | tensor_type = pa.fixed_shape_tensor(pa.int32(), [2, 2]) |
| 50 | arr = [[1, 2, 3, 4], [10, 20, 30, 40], [100, 200, 300, 400]] |
| 51 | storage = pa.array(arr, pa.list_(pa.int32(), 4)) |
| 52 | tensor_array = pa.ExtensionArray.from_storage(tensor_type, storage) |
| 53 | |
| 54 | tensor = tensor_array.to_tensor() |
| 55 | msg = "Cannot return a numpy.ndarray if NumPy is not present" |
| 56 | |
| 57 | with pytest.raises(ImportError, match=msg): |
| 58 | tensor.to_numpy() |