MCPcopy Create free account
hub / github.com/apache/arrow / test_dlpack_not_supported

Function test_dlpack_not_supported

python/pyarrow/tests/test_dlpack.py:334–355  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

332
333
334def 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
358def test_dlpack_cuda_not_supported():

Callers

nothing calls this directly

Calls 1

arrayMethod · 0.45

Tested by

no test coverage detected