Skip to content

Enabling attribute tests for reading data from groups #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/SharedZarrTestSetup.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ChunkSize = [4 5]

% Path for write tests
GrpPathWrite = "prt_grp_write"
ArrPathWrite = "prt_grp_write/arr1"
end

Expand Down
20 changes: 15 additions & 5 deletions test/tZarrAttributes.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
function createZarrArrayWithAttrs(testcase)
% Create Zarr array and add some attributes.
zarrcreate(testcase.ArrPathWrite,testcase.ArrSize);

% Write array attributes
zarrwriteatt(testcase.ArrPathWrite,'attr1','This is an array attribute.');
zarrwriteatt(testcase.ArrPathWrite,'attr2',{1,2,3});
attr3.numVal = 10;
attr3.strArr = ["array","attribute"];
zarrwriteatt(testcase.ArrPathWrite,'attr3',attr3);

% Write group attributes
zarrwriteatt(testcase.GrpPathWrite,'grp_description','This is a group');
zarrwriteatt(testcase.GrpPathWrite,'grp_level',1);
end
end

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

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

function verifyGroupAttributeInfo(testcase)
% Write attribute info using zarrwriteatt function to a group.
testcase.assumeTrue(false,'Filtered until Issue-35 is fixed.');
% Verify group attribute info.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we already have a test for zarrwriteatt for groups?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the test file creation by adding zarrwriteatt calls to a group. Accordingly, I have updated the testpoint to read and verify attributes using this change.

grpInfo = zarrinfo(testcase.GrpPathWrite);

actAttr1 = grpInfo.grp_description;
expAttr1 = 'This is a group';
testcase.verifyEqual(actAttr1,expAttr1,'Failed to verify text attribute.');

% Unable to read attribute data from a group/array created
% using Python.
actAttr2 = grpInfo.grp_level;
expAttr2 = 1;
testcase.verifyEqual(actAttr2,expAttr2,'Failed to verify numeric attribute.');
end

function verifyZarrV3WriteError(testcase)
Expand Down