Skip to content
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

Raises errors if attempt to use function or data backgrounds #252

Merged
merged 5 commits into from
Aug 6, 2024

Conversation

alexhroom
Copy link
Collaborator

@alexhroom alexhroom commented Aug 1, 2024

Fixes #245 by adding a new exception type notImplemented and raises it if the user attempts to use a data or function background.

Presently, the relevant test parts have been commented out. If someone thinks it's better to remove them entirely, please let me know.

@alexhroom alexhroom requested a review from DrPaulSharp August 1, 2024 14:59
@alexhroom alexhroom changed the title Added errors if attempt to use function or data backgrounds Raises errors if attempt to use function or data backgrounds Aug 1, 2024
@alexhroom alexhroom force-pushed the 245-unsupported-backs branch from 0e6161d to a98f76d Compare August 1, 2024 15:02
@alexhroom alexhroom linked an issue Aug 1, 2024 that may be closed by this pull request
@alexhroom alexhroom force-pushed the 245-unsupported-backs branch from a98f76d to 4b2225b Compare August 2, 2024 09:07
Copy link
Collaborator

@DrPaulSharp DrPaulSharp left a comment

Choose a reason for hiding this comment

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

This looks good, please review testBackgrounds.m to see if some of the tests can be re-introduced.

% string(testCase.backgrounds(3, :)), 'addBackground method not working');
%testCase.background.addBackground(testCase.backgrounds{4, :});
%testCase.verifyEqual(string(testCase.background.backgrounds.varTable{end, :}),...
% string(testCase.backgrounds(4, :)), 'addBackground method not working');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given the changes to the test input data, can these lines be uncommented?

% 'addBackground method not working');
%testCase.verifyError(@() testCase.background.addBackground('New', 'fixed'), exceptions.invalidOption.errorID);
%testCase.verifyError(@() testCase.background.addBackground('New', allowedTypes.Constant), exceptions.invalidNumberOfInputs.errorID);
%testCase.verifyError(@() testCase.background.addBackground('New', allowedTypes.Constant.value, 6), exceptions.indexOutOfRange.errorID);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The three lines here testing the errors can be uncommented too.

testCase.verifyError(@() testCase.background.setBackground(2, 'type', 'random'), exceptions.invalidOption.errorID);
%testCase.background.setBackground('Background 1', 'type', allowedTypes.Function);
%testCase.verifyEqual(testCase.background.backgrounds.varTable{1, 2}, string(allowedTypes.Function.value), 'setBackground method not working');
%testCase.verifyError(@() testCase.background.setBackground(2, 'type', 'random'), exceptions.invalidOption.errorID);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Uncomment this line.

%testCase.background.setBackground(3, 'Value1', 'random');
%testCase.verifyEqual(testCase.background.backgrounds.varTable{3, 3}, "random", 'setBackground method not working');
%testCase.background.setBackground('Background 3', 'Value1', 'Background param 1');
%testCase.verifyEqual(testCase.background.backgrounds.varTable{3, 3}, "Background param 1", 'setBackground method not working');
Copy link
Collaborator

Choose a reason for hiding this comment

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

and these lines.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can't uncomment 142-143 as i'd changed background 3 to a constant background - Value1 of a constant background is validated but Value1 of a function background is not, so you can't just arbitrarily set Value1 for a test unless the background type is function

@alexhroom alexhroom requested a review from DrPaulSharp August 5, 2024 12:48
@alexhroom alexhroom merged commit 1434829 into RascalSoftware:master Aug 6, 2024
5 checks passed
@alexhroom alexhroom deleted the 245-unsupported-backs branch August 6, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data and function backgrounds/resolutions are not yet supported
2 participants