File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class Buffer(core.Buffer):
5252
5353 def __init__ (self , array_like : ArrayLike ) -> None :
5454 if cp is None :
55- raise ImportError (
55+ raise ImportError ( # pragma: no cover
5656 "Cannot use zarr.buffer.gpu.Buffer without cupy. Please install cupy."
5757 )
5858
@@ -141,7 +141,7 @@ class NDBuffer(core.NDBuffer):
141141
142142 def __init__ (self , array : NDArrayLike ) -> None :
143143 if cp is None :
144- raise ImportError (
144+ raise ImportError ( # pragma: no cover
145145 "Cannot use zarr.buffer.gpu.NDBuffer without cupy. Please install cupy."
146146 )
147147
Original file line number Diff line number Diff line change @@ -186,6 +186,19 @@ def test_numpy_buffer_prototype() -> None:
186186 ndbuffer .as_scalar ()
187187
188188
189+ @gpu_test
190+ def test_gpu_buffer_raises () -> None :
191+ import cupy as cp
192+
193+ arr = cp .empty ((10 , 10 ), dtype = "B" )
194+ with pytest .raises (ValueError , match = "array_like: only 1-dim allowed" ):
195+ gpu .Buffer (arr )
196+
197+ arr = cp .arange (12 , dtype = "int32" )
198+ with pytest .raises (ValueError , match = "array_like: only byte dtype allowed" ):
199+ gpu .Buffer (arr )
200+
201+
189202@gpu_test
190203def test_gpu_buffer_prototype () -> None :
191204 buffer = gpu .buffer_prototype .buffer .create_zero_length ()
You can’t perform that action at this time.
0 commit comments