1111import xarray .testing as xrt
1212from xarray .tests import has_zarr_v3 , requires_zarr_v3
1313
14+
1415if has_zarr_v3 :
1516 import zarr
1617 from zarr .abc .store import ByteRequest , Store
@@ -146,20 +147,6 @@ def assert_time_as_expected(
146147 abs (total_time - latency ) < 2.0
147148 ) # Should take approximately `latency` seconds, but allow some buffer
148149
149- async def test_concurrent_load_multiple_objects (self , xr_obj ) -> None :
150- N_OBJECTS = 5
151-
152- async with AsyncTimer ().measure () as timer :
153- tasks = [xr_obj .load_async () for _ in range (N_OBJECTS )]
154- results = await asyncio .gather (* tasks )
155-
156- for result in results :
157- xrt .assert_identical (result , xr_obj .load ())
158-
159- self .assert_time_as_expected (
160- total_time = timer .total_time , latency = self .LATENCY , n_loads = N_OBJECTS
161- )
162-
163150 async def test_concurrent_load_multiple_variables (self , memorystore ) -> None :
164151 latencystore = LatencyStore (memorystore , latency = self .LATENCY )
165152 ds = xr .open_zarr (latencystore , zarr_format = 3 , consolidated = False , chunks = None )
@@ -174,3 +161,17 @@ async def test_concurrent_load_multiple_variables(self, memorystore) -> None:
174161 self .assert_time_as_expected (
175162 total_time = timer .total_time , latency = self .LATENCY , n_loads = 2
176163 )
164+
165+ async def test_concurrent_load_multiple_objects (self , xr_obj ) -> None :
166+ N_OBJECTS = 5
167+
168+ async with AsyncTimer ().measure () as timer :
169+ coros = [xr_obj .load_async () for _ in range (N_OBJECTS )]
170+ results = await asyncio .gather (* coros )
171+
172+ for result in results :
173+ xrt .assert_identical (result , xr_obj .load ())
174+
175+ self .assert_time_as_expected (
176+ total_time = timer .total_time , latency = self .LATENCY , n_loads = N_OBJECTS
177+ )
0 commit comments