1
+ classdef tZarr < SharedZarrTestSetup
2
+ % Tests for Zarr class methods
3
+
4
+ % Copyright 2025 The MathWorks, Inc.
5
+
6
+ methods (Test )
7
+
8
+ function verifySupportedCloudPatterns(testcase )
9
+ % Verify that the bucket name and the array path can be
10
+ % extracted successfully if a cloud path is used as an input.
11
+
12
+ % This list contains path pattern currently supported by Zarr
13
+ % in MATLAB. Any invalid path not matching any of these
14
+ % patterns will result in an error.
15
+ inpPath = {' https://mybucket.s3.us-west-2.amazonaws.com/path/to/myZarrFile' , ...
16
+ ' https://mybucket.s3.amazonaws.com/path/to/myZarrFile' , ...
17
+ ' https://mybucket.s3.custom-endpoint.org/path/to/myZarrFile' , ...
18
+ ' https://s3.amazonaws.com/mybucket/path/to/myZarrFile' , ...
19
+ ' https://s3.eu-central-1.example.edu/mybucket/path/to/myZarrFile' , ...
20
+ ' s3://mybucket/path/to/myZarrFile' };
21
+
22
+ for i = 1 : length(inpPath )
23
+ [bucketName , objectPath ] = Zarr .extractS3BucketNameAndPath(inpPath{i });
24
+ testcase .verifyEqual(bucketName , ' mybucket' , [' Bucket name extraction failed for ' inpPath{i }]);
25
+ testcase .verifyEqual(objectPath , ' path/to/myZarrFile' , [' Object path extraction failed for ' inpPath{i }]);
26
+ end
27
+ end
28
+
29
+ function verifyReload(testcase )
30
+ % Verify that calling reload method does not cause any issues
31
+
32
+ Zarr .pyReloadInProcess();
33
+ zarrPyModule = Zarr .ZarrPy ;
34
+ testcase .verifyTrue(isa(zarrPyModule , ' py.module' ))
35
+
36
+ end
37
+
38
+
39
+ end
40
+ end
0 commit comments