@@ -268,7 +268,6 @@ def test_asarray_cross_library(source_library, target_library, request):
268
268
assert b .dtype == tgt_lib .int32
269
269
270
270
271
-
272
271
@pytest .mark .parametrize ("library" , wrapped_libraries )
273
272
def test_asarray_copy (library ):
274
273
# Note, we have this test here because the test suite currently doesn't
@@ -323,21 +322,21 @@ def test_asarray_copy(library):
323
322
324
323
# Python built-in types
325
324
for obj in [True , 0 , 0.0 , 0j , [0 ], [[0 ]]]:
326
- asarray (obj , copy = True ) # No error
327
- asarray (obj , copy = None ) # No error
325
+ asarray (obj , copy = True ) # No error
326
+ asarray (obj , copy = None ) # No error
328
327
329
328
with pytest .raises (ValueError ):
330
329
asarray (obj , copy = False )
331
330
332
331
# Use the standard library array to test the buffer protocol
333
- a = array .array ('f' , [1.0 ])
332
+ a = array .array ("f" , [1.0 ])
334
333
b = asarray (a , copy = True )
335
334
assert is_lib_func (b )
336
335
a [0 ] = 0.0
337
336
assert b [0 ] == 1.0
338
337
339
- a = array .array ('f' , [1.0 ])
340
- if library in (' cupy' , ' dask.array' ):
338
+ a = array .array ("f" , [1.0 ])
339
+ if library in (" cupy" , " dask.array" ):
341
340
with pytest .raises (ValueError ):
342
341
asarray (a , copy = False )
343
342
else :
@@ -346,11 +345,11 @@ def test_asarray_copy(library):
346
345
a [0 ] = 0.0
347
346
assert b [0 ] == 0.0
348
347
349
- a = array .array ('f' , [1.0 ])
348
+ a = array .array ("f" , [1.0 ])
350
349
b = asarray (a , copy = None )
351
350
assert is_lib_func (b )
352
351
a [0 ] = 0.0
353
- if library in (' cupy' , ' dask.array' ):
352
+ if library in (" cupy" , " dask.array" ):
354
353
# A copy is required for libraries where the default device is not CPU
355
354
# dask changed behaviour of copy=None in 2024.12 to copy;
356
355
# this wrapper ensures the same behaviour in older versions too.
0 commit comments