4
4
% Copyright 2025 The MathWorks, Inc.
5
5
6
6
methods (Test )
7
-
8
7
function createIntermediateZgroups(testcase )
9
8
% Verify that zarrcreate creates zarr groups when given a
10
9
% nested path
11
-
12
10
arrayPath = fullfile(testcase .ArrPathWrite , " A" , " B" );
13
11
zarrcreate(arrayPath , testcase .ArrSize );
14
12
[groupPath , ~ , ~ ] = fileparts(arrayPath );
@@ -19,12 +17,27 @@ function createIntermediateZgroups(testcase)
19
17
grpInfo = zarrinfo(groupPath );
20
18
expFormat = ' 2' ;
21
19
expType = ' group' ;
22
-
20
+
23
21
testcase .verifyEqual(grpInfo .zarr_format , expFormat ,...
24
22
" Unexpected Zarr group format" );
25
23
testcase .verifyEqual(grpInfo .node_type , expType ,...
26
24
" Unexpected Zarr group node type" );
25
+ end
27
26
27
+ function createArrayRelativePath(testcase )
28
+ % Verify that the array is successfully created if a relative
29
+ % path is used.
30
+ newDir = ' myFolder' ;
31
+ currDir = pwd ;
32
+ mkdir(newDir );
33
+ testcase .addTeardown(@()cd(currDir ));
34
+
35
+ cd(newDir );
36
+ inpPath = fullfile(' ..' ,' myGrp' ,' myArr' );
37
+ zarrcreate(inpPath ,[10 10 ]);
38
+ arrInfo = zarrinfo(inpPath );
39
+ testcase .verifyEqual(arrInfo .zarr_format ,2 ,' Failed to Zarr array format' );
40
+ testcase .verifyEqual(arrInfo .node_type ,' array' ,' Unexpected Zarr array node type' );
28
41
end
29
42
30
43
function invalidFilePath(testcase )
@@ -42,6 +55,14 @@ function invalidFilePath(testcase)
42
55
43
56
% Non-text input
44
57
testcase .verifyError(@()zarrcreate([],testcase .ArrSize ),errID );
58
+
59
+ % Invalid bucket path
60
+ errID = ' MATLAB:Zarr:invalidS3URL' ;
61
+ inpPath = ' https://invalid/arr/path' ;
62
+ testcase .verifyError(@()zarrcreate(inpPath ,[10 10 ]),errID );
63
+
64
+ inpPath = ' http://invalid/arr/path' ;
65
+ testcase .verifyError(@()zarrcreate(inpPath ,[10 10 ]),errID );
45
66
end
46
67
47
68
function pathContainingInvalidChars(testcase )
@@ -60,7 +81,7 @@ function chunkSizeGreaterThanArraySize(testcase)
60
81
testcase .verifyError(@()zarrcreate(testcase .ArrPathWrite ,testcase .ArrSize , ...
61
82
' ChunkSize' ,chunkSize ),errID );
62
83
end
63
-
84
+
64
85
function chunkSizeMismatch(testcase )
65
86
% Verify error when there is a mismatch between Array size and
66
87
% Chunk size.
@@ -72,7 +93,7 @@ function chunkSizeMismatch(testcase)
72
93
end
73
94
74
95
function invalidClevelBlosc(testcase )
75
- % Verify error when an invalid clevel value is used with blosc
96
+ % Verify error when an invalid clevel value is used with blosc
76
97
% compression. Valid values are [0 9], where 0 is for no compression.
77
98
comp.id = ' blosc' ;
78
99
level = {-1 ,10 ,NaN };
@@ -87,7 +108,7 @@ function invalidClevelBlosc(testcase)
87
108
end
88
109
89
110
function invalidBlockSizeBlosc(testcase )
90
- % Verify error when an invalid blocksize value is used with blosc
111
+ % Verify error when an invalid blocksize value is used with blosc
91
112
% compression. Valid values for blocksize are [0 inf].
92
113
comp.id = ' blosc' ;
93
114
comp.level = 5 ;
@@ -103,7 +124,7 @@ function invalidBlockSizeBlosc(testcase)
103
124
end
104
125
105
126
function invalidCnameBlosc(testcase )
106
- % Verify error when an invalid cname value is used with blosc
127
+ % Verify error when an invalid cname value is used with blosc
107
128
% compression.
108
129
comp.id = ' blosc' ;
109
130
comp.level = 5 ;
@@ -161,7 +182,6 @@ function invalidSizeInput(testcase)
161
182
% testcase.PyException);
162
183
end
163
184
164
-
165
185
function invalidDatatype(testcase )
166
186
% Verify the error when an usupported datatype is used.
167
187
testcase .verifyError(@()zarrcreate(testcase .ArrPathWrite ,...
@@ -184,8 +204,8 @@ function invalidCompressionInputType(testcase)
184
204
end
185
205
186
206
function invalidCompressionMember(testcase )
187
- % Verify error when additional compression members (cname, blocksize,
188
- % and shuffle) are used. These members are not supported for
207
+ % Verify error when additional compression members (cname, blocksize,
208
+ % and shuffle) are used. These members are not supported for
189
209
% compression other than blosc.
190
210
compType = {' gzip' ,' zlib' ,' bz2' ,' zstd' };
191
211
comp.level = 5 ;
@@ -206,7 +226,7 @@ function zlibInvalidCompressionLevel(testcase)
206
226
errID = ' MATLAB:Zarr:missingCompressionID' ;
207
227
testcase .verifyError(@()zarrcreate(testcase .ArrPathWrite ,testcase .ArrSize , ...
208
228
' Compression' ,comp ),errID );
209
-
229
+
210
230
comp.id = ' zlib' ;
211
231
comp.level = - 1 ;
212
232
testcase .verifyError(@()zarrcreate(testcase .ArrPathWrite ,testcase .ArrSize , ...
@@ -273,7 +293,7 @@ function zstdInvalidCompressionLevel(testcase)
273
293
end
274
294
275
295
function tooFewInputs(testcase )
276
- % Verify error when too few inputs are passed to the zarrcreate
296
+ % Verify error when too few inputs are passed to the zarrcreate
277
297
% function.
278
298
errID = ' MATLAB:minrhs' ;
279
299
testcase .verifyError(@()zarrcreate(),errID );
0 commit comments