@@ -195,7 +195,7 @@ async def test_fsspec_store_from_uri(self, store: FsspecStore) -> None:
195195 )
196196 assert dict (group .attrs ) == {"key" : "value" }
197197
198- meta ["attributes" ]["key" ] = "value-2" # type: ignore[index]
198+ meta ["attributes" ]["key" ] = "value-2"
199199 await store .set (
200200 "directory-2/zarr.json" ,
201201 self .buffer_cls .from_bytes (json .dumps (meta ).encode ()),
@@ -205,7 +205,7 @@ async def test_fsspec_store_from_uri(self, store: FsspecStore) -> None:
205205 )
206206 assert dict (group .attrs ) == {"key" : "value-2" }
207207
208- meta ["attributes" ]["key" ] = "value-3" # type: ignore[index]
208+ meta ["attributes" ]["key" ] = "value-3"
209209 await store .set (
210210 "directory-3/zarr.json" ,
211211 self .buffer_cls .from_bytes (json .dumps (meta ).encode ()),
@@ -268,32 +268,31 @@ async def test_delete_dir_unsupported_deletes(self, store: FsspecStore) -> None:
268268 await store .delete_dir ("test_prefix" )
269269
270270
271- def array_roundtrip (store ) :
271+ def array_roundtrip (store : FsspecStore ) -> None :
272272 """
273273 Round trip an array using a Zarr store
274274
275275 Args:
276- store: Store-Like object (e.g., FSMap)
276+ store: FsspecStore
277277 """
278- arr = zarr .open (store = store , mode = "w" , shape = (3 , 3 ))
278+ data = np .ones ((3 , 3 ))
279+ arr = zarr .create_array (store = store , overwrite = True , data = data )
279280 assert isinstance (arr , Array )
280- # Set values
281- arr [:] = 1
282281 # Read set values
283- arr = zarr .open (store = store , mode = "r" , shape = ( 3 , 3 ) )
284- assert isinstance (arr , Array )
285- np .testing .assert_array_equal (np . ones (( 3 , 3 )), arr [:])
282+ arr2 = zarr .open_array (store = store )
283+ assert isinstance (arr2 , Array )
284+ np .testing .assert_array_equal (arr [:], data )
286285
287286
288287@pytest .mark .skipif (
289288 parse_version (fsspec .__version__ ) < parse_version ("2024.12.0" ),
290289 reason = "No AsyncFileSystemWrapper" ,
291290)
292- def test_wrap_sync_filesystem (tmp_path ) -> None :
291+ def test_wrap_sync_filesystem (tmp_path : pathlib . Path ) -> None :
293292 """The local fs is not async so we should expect it to be wrapped automatically"""
294293 from fsspec .implementations .asyn_wrapper import AsyncFileSystemWrapper
295294
296- store = FsspecStore .from_url (f"local ://{ tmp_path } " , storage_options = {"auto_mkdir" : True })
295+ store = FsspecStore .from_url (f"file ://{ tmp_path } " , storage_options = {"auto_mkdir" : True })
297296 assert isinstance (store .fs , AsyncFileSystemWrapper )
298297 assert store .fs .async_impl
299298 array_roundtrip (store )
@@ -303,23 +302,24 @@ def test_wrap_sync_filesystem(tmp_path) -> None:
303302 parse_version (fsspec .__version__ ) >= parse_version ("2024.12.0" ),
304303 reason = "No AsyncFileSystemWrapper" ,
305304)
306- def test_wrap_sync_filesystem_raises (tmp_path ) :
305+ def test_wrap_sync_filesystem_raises (tmp_path : pathlib . Path ) -> None :
307306 """The local fs is not async so we should expect it to be wrapped automatically"""
308307 with pytest .raises (ImportError , match = "The filesystem .*" ):
309- FsspecStore .from_url (f"local ://{ tmp_path } " , storage_options = {"auto_mkdir" : True })
308+ FsspecStore .from_url (f"file ://{ tmp_path } " , storage_options = {"auto_mkdir" : True })
310309
311310
312311@pytest .mark .skipif (
313312 parse_version (fsspec .__version__ ) < parse_version ("2024.12.0" ),
314313 reason = "No AsyncFileSystemWrapper" ,
315314)
316- def test_no_wrap_async_filesystem ():
315+ def test_no_wrap_async_filesystem () -> None :
317316 """An async fs should not be wrapped automatically; fsspec's s3 filesystem is such an fs"""
318317 from fsspec .implementations .asyn_wrapper import AsyncFileSystemWrapper
319318
320319 store = FsspecStore .from_url (
321320 f"s3://{ test_bucket_name } /foo/spam/" ,
322- storage_options = {"endpoint_url" : endpoint_url , "anon" : False },
321+ storage_options = {"endpoint_url" : endpoint_url , "anon" : False , "asynchronous" : True },
322+ read_only = False ,
323323 )
324324 assert not isinstance (store .fs , AsyncFileSystemWrapper )
325325 assert store .fs .async_impl
0 commit comments