@@ -968,15 +968,25 @@ def test_s3_complex(self):
968
968
expected [3 ] = 3
969
969
a [:4 ] = expected [:4 ]
970
970
971
- a = g .create_dataset ("data_f" , shape = (8 , ), chunks = (1 ,),
971
+ b = g .create_dataset ("data_f" , shape = (8 , ), chunks = (1 ,),
972
972
dtype = [('foo' , 'S3' ), ('bar' , 'i4' )],
973
973
fill_value = (b"b" , 1 ))
974
- a [:4 ] = (b"aaa" , 2 )
975
- g = zarr .open_group ("s3://test/out.zarr" , mode = 'r' ,
976
- storage_options = self .s3so )
974
+ b [:4 ] = (b"aaa" , 2 )
975
+ g2 = zarr .open_group ("s3://test/out.zarr" , mode = 'r' ,
976
+ storage_options = self .s3so )
977
+
978
+ assert (g2 .data [:] == expected ).all ()
979
+ assert g2 .data_f ['foo' ].tolist () == [b"aaa" ] * 4 + [b"b" ] * 4
980
+ with pytest .raises (PermissionError ):
981
+ g2 .data [:] = 5
982
+ with pytest .raises (PermissionError ):
983
+ # even though overwrite=True, store is read-only, so fails
984
+ g2 .create_dataset ("data" , shape = (8 , 8 , 8 ), mode = 'w' ,
985
+ fill_value = - 1 , chunks = (1 , 1 , 1 ), overwrite = True )
977
986
978
- assert (g .data [:] == expected ).all ()
979
- assert g .data_f ['foo' ].tolist () == [b"aaa" ] * 4 + [b"b" ] * 4
987
+ a = g .create_dataset ("data" , shape = (8 , 8 , 8 ), mode = 'w' ,
988
+ fill_value = - 1 , chunks = (1 , 1 , 1 ), overwrite = True )
989
+ assert (a [:] == - np .ones ((8 , 8 , 8 ))).all ()
980
990
981
991
982
992
@pytest .fixture ()
0 commit comments