-
Notifications
You must be signed in to change notification settings - Fork 5
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
Raises errors if attempt to use function or data backgrounds #252
Conversation
0e6161d
to
a98f76d
Compare
a98f76d
to
4b2225b
Compare
There was a problem hiding this 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.
tests/testBackgroundsClass.m
Outdated
% 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'); |
There was a problem hiding this comment.
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?
tests/testBackgroundsClass.m
Outdated
% '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); |
There was a problem hiding this comment.
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.
tests/testBackgroundsClass.m
Outdated
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uncomment this line.
tests/testBackgroundsClass.m
Outdated
%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'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and these lines.
There was a problem hiding this comment.
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
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.