@@ -2263,31 +2263,13 @@ def test_create_array_with_data_num_gets(
22632263 assert store .counter ["get" ] == 1
22642264
22652265
2266- def test_full_shard_write_num_gets () -> None :
2267- """
2268- Test that overwriting a complete shard does not read the existing shard first.
2269- """
2270- store = LoggingStore (store = MemoryStore ())
2271- arr = zarr .create_array (
2272- store ,
2273- shape = (10 ,),
2274- chunks = (1 ,),
2275- shards = (10 ,),
2276- dtype = "int64" ,
2277- fill_value = - 1 ,
2278- )
2279- arr [:] = 0
2280-
2281- store .counter .clear ()
2282-
2283- arr [:] = np .arange (10 , dtype = "int64" )
2284-
2285- assert store .counter ["get" ] == 0
2286-
2287-
2288- def test_partial_shard_write_num_gets () -> None :
2266+ @pytest .mark .parametrize (
2267+ ("selection" , "expected_gets" ),
2268+ [(slice (None ), 0 ), (slice (1 , 9 ), 1 )],
2269+ )
2270+ def test_shard_write_num_gets (selection : slice , expected_gets : int ) -> None :
22892271 """
2290- Test that partial shard writes still read the existing shard to preserve untouched chunks .
2272+ Test that partial- shard writes read the existing data and full-shard writes don't .
22912273 """
22922274 store = LoggingStore (store = MemoryStore ())
22932275 arr = zarr .create_array (
@@ -2302,9 +2284,9 @@ def test_partial_shard_write_num_gets() -> None:
23022284
23032285 store .counter .clear ()
23042286
2305- arr [1 : 9 ] = np . arange ( 8 , dtype = "int64" )
2287+ arr [selection ] = 1
23062288
2307- assert store .counter ["get" ] == 1
2289+ assert store .counter ["get" ] == expected_gets
23082290
23092291
23102292@pytest .mark .parametrize ("config" , [{}, {"write_empty_chunks" : True }, {"order" : "C" }])
0 commit comments