Skip to content

Commit c8572f9

Browse files
committed
Suppress more expected warnings and outputs
1 parent 2505a98 commit c8572f9

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

+tests/+unit/nwbExportTest.m

+13-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function testExportNwbFileWithMissingRequiredLink(testCase)
5454
% an error.
5555

5656
electrode = types.core.IntracellularElectrode('description', 'test');
57-
testCase.NwbObject.general_intracellular_ephys.set('Electrode', electrode)
57+
testCase.NwbObject.general_intracellular_ephys.set('Electrode', electrode);
5858

5959
nwbFilePath = 'testExportNwbFileWithMissingRequiredLink.nwb';
6060
testCase.verifyError(@(f, fn) nwbExport(testCase.NwbObject, nwbFilePath), ...
@@ -88,6 +88,7 @@ function testExportWithMissingRequiredDependentProperty(testCase)
8888
end
8989

9090
function testExportFileWithAttributeOfEmptyDataset(testCase)
91+
import matlab.unittest.fixtures.SuppressedWarningsFixture
9192

9293
nwbFile = testCase.initNwbFile();
9394

@@ -106,10 +107,12 @@ function testExportFileWithAttributeOfEmptyDataset(testCase)
106107
@() nwbExport(nwbFile, 'test_1.nwb'))
107108

108109
% Change value for attribute of the grid_spacing dataset.
109-
% Because grid_spacing is not set, this attribute value is not
110-
% exported to the file. Verify that warning is issued.
110+
testCase.applyFixture(...
111+
SuppressedWarningsFixture('NWB:AttributeDependencyNotSet'))
111112
imaging_plane.grid_spacing_unit = "microns";
112113

114+
% Because grid_spacing is not set, this attribute value is not
115+
% exported to the file. Verify that warning is issued on export.
113116
testCase.verifyWarning(...
114117
@() nwbExport(nwbFile, 'test_2.nwb'), ...
115118
'NWB:DependentAttributeNotExported')
@@ -129,9 +132,15 @@ function testExportTimeseriesWithMissingTimestampsAndStartingTime(testCase)
129132
end
130133

131134
function testExportDependentAttributeWithMissingParentA(testCase)
135+
import matlab.unittest.fixtures.SuppressedWarningsFixture
136+
testCase.applyFixture(...
137+
SuppressedWarningsFixture('NWB:AttributeDependencyNotSet'))
138+
132139
testCase.NwbObject.general_source_script_file_name = 'my_test_script.m';
133140
nwbFilePath = fullfile(testCase.OutputFolder, 'test_part1.nwb');
134-
testCase.verifyWarning(@(f, fn) nwbExport(testCase.NwbObject, nwbFilePath), 'NWB:DependentAttributeNotExported')
141+
testCase.verifyWarning(...
142+
@(f, fn) nwbExport(testCase.NwbObject, nwbFilePath), ...
143+
'NWB:DependentAttributeNotExported')
135144

136145
% Add value for dataset which attribute depends on and export again
137146
testCase.NwbObject.general_source_script = 'my test';

0 commit comments

Comments
 (0)