| 332 | |
| 333 | |
| 334 | def test_dlpack_not_supported(): |
| 335 | arr = pa.array([1, None, 3]) |
| 336 | with pytest.raises(TypeError, match="Can only use DLPack " |
| 337 | "on arrays with no nulls."): |
| 338 | np.from_dlpack(arr) |
| 339 | |
| 340 | arr = pa.array( |
| 341 | [[0, 1], [3, 4]], |
| 342 | type=pa.list_(pa.int32()) |
| 343 | ) |
| 344 | with pytest.raises(TypeError, match="DataType is not compatible with DLPack spec"): |
| 345 | np.from_dlpack(arr) |
| 346 | |
| 347 | arr = pa.array([]) |
| 348 | with pytest.raises(TypeError, match="DataType is not compatible with DLPack spec"): |
| 349 | np.from_dlpack(arr) |
| 350 | |
| 351 | # DLPack doesn't support bit-packed boolean values |
| 352 | arr = pa.array([True, False, True]) |
| 353 | with pytest.raises(TypeError, match="Bit-packed boolean data type " |
| 354 | "not supported by DLPack."): |
| 355 | np.from_dlpack(arr) |
| 356 | |
| 357 | |
| 358 | def test_dlpack_cuda_not_supported(): |