diff --git a/tests/integration/hdf5/test_nwbfile.py b/tests/integration/hdf5/test_nwbfile.py index e164ec649..24a08eb1b 100644 --- a/tests/integration/hdf5/test_nwbfile.py +++ b/tests/integration/hdf5/test_nwbfile.py @@ -42,6 +42,7 @@ def setUp(self): session_id='007', slices='noslices', source_script='nosources', + was_generated_by=[('nosoftware', '0.0.0')], surgery='nosurgery', virus='novirus', source_script_file_name='nofilename') @@ -128,6 +129,7 @@ def build_nwbfile(self): virus='a virus', source_script='noscript', source_script_file_name='nofilename', + was_generated_by=[('nosoftware', '0.0.0')], stimulus_notes='test stimulus notes', data_collection='test data collection notes', keywords=('these', 'are', 'keywords')) @@ -176,6 +178,32 @@ def build_nwbfile(self): self.nwbfile.experimenter = ('experimenter1', 'experimenter2') +class TestWasGeneratedByConstructorRoundtrip(TestNWBFileIO): + """ Test that a list of software packages / versions in a constructor is written to and read from file """ + + def build_nwbfile(self): + description = 'test nwbfile was_generated_by' + identifier = 'TEST_was_generated_by' + self.nwbfile = NWBFile(session_description=description, + identifier=identifier, + session_start_time=self.start_time, + was_generated_by=[('software1', '0.1.0'), + ('software2', '0.2.0'), + ('software3', '0.3.0')],) + +class TestWasGeneratedBySetterRoundtrip(TestNWBFileIO): + """ Test that a single tuple of software versions packages in a setter is written to and read from file """ + + def build_nwbfile(self): + description = 'test nwbfile was_generated_by' + identifier = 'TEST_was_generated_by' + self.nwbfile = NWBFile(session_description=description, + identifier=identifier, + session_start_time=self.start_time) + self.nwbfile.was_generated_by = [('software1', '0.1.0'), + ('software2', '0.2.0'), + ('software3', '0.3.0')] + class TestPublicationsConstructorRoundtrip(TestNWBFileIO): """ Test that a list of multiple publications in a constructor is written to and read from file """ diff --git a/tests/unit/test_file.py b/tests/unit/test_file.py index 98446fa46..db24c17f3 100644 --- a/tests/unit/test_file.py +++ b/tests/unit/test_file.py @@ -42,6 +42,7 @@ def setUp(self): virus='a virus', source_script='noscript', source_script_file_name='nofilename', + was_generated_by=[('nosoftware', '0.0.0')], stimulus_notes='test stimulus notes', data_collection='test data collection notes', keywords=('these', 'are', 'keywords')) @@ -61,6 +62,7 @@ def test_constructor(self): self.assertEqual(self.nwbfile.related_publications, ('my pubs',)) self.assertEqual(self.nwbfile.source_script, 'noscript') self.assertEqual(self.nwbfile.source_script_file_name, 'nofilename') + self.assertEqual(self.nwbfile.was_generated_by, [('nosoftware', '0.0.0')]) self.assertEqual(self.nwbfile.keywords, ('these', 'are', 'keywords')) self.assertEqual(self.nwbfile.timestamps_reference_time, self.ref_time)