Skip to content

Commit 1ad7173

Browse files
authored
Merge pull request #104 from mathworks/update_attr_tests
Enabling attribute tests for reading data from groups
2 parents 7ca2c2f + 63f4a39 commit 1ad7173

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

test/SharedZarrTestSetup.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
ChunkSize = [4 5]
1010

1111
% Path for write tests
12+
GrpPathWrite = "prt_grp_write"
1213
ArrPathWrite = "prt_grp_write/arr1"
1314
end
1415

test/tZarrAttributes.m

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
function createZarrArrayWithAttrs(testcase)
88
% Create Zarr array and add some attributes.
99
zarrcreate(testcase.ArrPathWrite,testcase.ArrSize);
10+
11+
% Write array attributes
1012
zarrwriteatt(testcase.ArrPathWrite,'attr1','This is an array attribute.');
1113
zarrwriteatt(testcase.ArrPathWrite,'attr2',{1,2,3});
1214
attr3.numVal = 10;
1315
attr3.strArr = ["array","attribute"];
1416
zarrwriteatt(testcase.ArrPathWrite,'attr3',attr3);
17+
18+
% Write group attributes
19+
zarrwriteatt(testcase.GrpPathWrite,'grp_description','This is a group');
20+
zarrwriteatt(testcase.GrpPathWrite,'grp_level',1);
1521
end
1622
end
1723

@@ -36,7 +42,6 @@ function verifyArrayAttributeInfo(testcase)
3642

3743
function verifyAttrOverwrite(testcase)
3844
% Verify attribute value after overwrite.
39-
%testcase.assumeTrue(false,'Filtered until the attributes display is fixed.');
4045
expAttrStr = ["new","attribute","value"];
4146
zarrwriteatt(testcase.ArrPathWrite,'attr1',expAttrStr);
4247
expAttrDbl = 10;
@@ -53,11 +58,16 @@ function verifyAttrOverwrite(testcase)
5358
end
5459

5560
function verifyGroupAttributeInfo(testcase)
56-
% Write attribute info using zarrwriteatt function to a group.
57-
testcase.assumeTrue(false,'Filtered until Issue-35 is fixed.');
61+
% Verify group attribute info.
62+
grpInfo = zarrinfo(testcase.GrpPathWrite);
63+
64+
actAttr1 = grpInfo.grp_description;
65+
expAttr1 = 'This is a group';
66+
testcase.verifyEqual(actAttr1,expAttr1,'Failed to verify text attribute.');
5867

59-
% Unable to read attribute data from a group/array created
60-
% using Python.
68+
actAttr2 = grpInfo.grp_level;
69+
expAttr2 = 1;
70+
testcase.verifyEqual(actAttr2,expAttr2,'Failed to verify numeric attribute.');
6171
end
6272

6373
function verifyZarrV3WriteError(testcase)

0 commit comments

Comments
 (0)