Skip to content

Commit

Permalink
add catch for extra warning
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince committed Dec 23, 2024
1 parent 1cf28a1 commit ac6a98a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/unit/test_scratch.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def test_scratch_notes_deprecation(self):
# test notes property
msg = ("Use of ScratchData.notes has been deprecated and will be removed in PyNWB 4.0. "
"Use ScratchData.description instead.")

with self.assertWarnsWith(DeprecationWarning, msg):
data.notes

Expand Down Expand Up @@ -106,9 +107,12 @@ def test_add_scratch_dataframe_no_description(self):
self.nwbfile.add_scratch(data, name='test')

def test_add_scratch_notes_and_description(self):
msg = 'Cannot call add_scratch with (notes or table_description) and description'
with self.assertRaisesWith(ValueError, msg):
self.nwbfile.add_scratch([1, 2, 3, 4], name='test', description='test data', notes='test notes')
error_msg = 'Cannot call add_scratch with (notes or table_description) and description'
warning_msg = ("Use of the `notes` or `table_description` argument is deprecated and will be "
"removed in PyNWB 4.0. Use the `description` argument instead.")
with self.assertWarnsWith(DeprecationWarning, warning_msg):
with self.assertRaisesWith(ValueError, error_msg):
self.nwbfile.add_scratch([1, 2, 3, 4], name='test', description='test data', notes='test notes')

def test_add_scratch_container(self):
data = TimeSeries(name='test_ts', data=[1, 2, 3, 4, 5], unit='unit', timestamps=[1.1, 1.2, 1.3, 1.4, 1.5])
Expand Down

0 comments on commit ac6a98a

Please sign in to comment.