Skip to content

Commit

Permalink
Add more tests for ListArray.fromMATLAB
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Nov 2, 2023
1 parent 4f5da67 commit 3179b77
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions matlab/test/arrow/array/list/tFromMATLAB.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,42 @@ function ClassTypeMismatchError(testCase)
testCase.verifyError(fcn, "arrow:array:list:ClassTypeMismatch");
end

function VariableNamesMismatchError(testCase)
% Verify fromMATLAB throws an error whose identifier is
% "arrow:array:list:VariableNamesMismatch" if given a cell
% array containing tables whose variable names don't match.

import arrow.array.ListArray

C = {table(1, "A"), table(2, "B", VariableNames=["X", "Y"])};
fcn = @() ListArray.fromMATLAB(C);
testCase.verifyError(fcn, "arrow:array:list:VariableNamesMismatch");
end

function ExpectedZonedDatetimeError(testCase)
% Verify fromMATLAB throws an error whose identifier is
% "arrow:array:list:ExpectedZonedDatetime" if given a cell
% array containing zoned and unzoned datetimes - in that order.

import arrow.array.ListArray

C = {datetime(2023, 11, 1, TimeZone="UTC"), datetime(2023, 11, 2)};
fcn = @() ListArray.fromMATLAB(C);
testCase.verifyError(fcn, "arrow:array:list:ExpectedZonedDatetime");
end

function ExpectedUnzonedDatetimeError(testCase)
% Verify fromMATLAB throws an error whose identifier is
% "arrow:array:list:ExpectedZonedDatetime" if given a cell
% array containing unzoned and zoned datetimes - in that order.

import arrow.array.ListArray

C = {datetime(2023, 11, 1), datetime(2023, 11, 2, TimeZone="UTC")};
fcn = @() ListArray.fromMATLAB(C);
testCase.verifyError(fcn, "arrow:array:list:ExpectedUnzonedDatetime");
end

end

end

0 comments on commit 3179b77

Please sign in to comment.