Skip to content

Commit

Permalink
add tests for stimulus template column
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince committed Jan 9, 2024
1 parent 2457ad3 commit fb60a07
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/unit/test_icephys_metadata_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,15 @@ def test_add_row_index_out_of_range(self):
response=self.response,
id=np.int64(10)
)
with self.assertRaises(IndexError):
ir = IntracellularRecordingsTable()
ir.add_recording(
electrode=self.electrode,
stimulus_template=self.stimulus,
stimulus_template_start_index=10,
response=self.response,
id=np.int64(10)
)
# Stimulus/Response index count too large
with self.assertRaises(IndexError):
ir = IntracellularRecordingsTable()
Expand All @@ -438,6 +447,15 @@ def test_add_row_index_out_of_range(self):
response=self.response,
id=np.int64(10)
)
with self.assertRaises(IndexError):
ir = IntracellularRecordingsTable()
ir.add_recording(
electrode=self.electrode,
stimulus_template=self.stimulus,
stimulus_template_index_count=10,
response=self.response,
id=np.int64(10)
)
# Stimulus/Response start+count combination too large
with self.assertRaises(IndexError):
ir = IntracellularRecordingsTable()
Expand All @@ -459,6 +477,16 @@ def test_add_row_index_out_of_range(self):
response=self.response,
id=np.int64(10)
)
with self.assertRaises(IndexError):
ir = IntracellularRecordingsTable()
ir.add_recording(
electrode=self.electrode,
stimulus_template=self.stimulus,
stimulus_template_start_index=3,
stimulus_template_index_count=4,
response=self.response,
id=np.int64(10)
)

def test_add_row_no_stimulus_and_response(self):
with self.assertRaises(ValueError):
Expand All @@ -469,6 +497,40 @@ def test_add_row_no_stimulus_and_response(self):
response=None
)

def test_add_row_with_stimulus_template(self):
ir = IntracellularRecordingsTable()
ir.add_recording(
electrode=self.electrode,
stimulus=self.stimulus,
stimulus_template=self.stimulus,
response=self.response,
id=np.int64(10)
)

def test_add_stimulus_template_column(self):
ir = IntracellularRecordingsTable()
ir.add_column(name='stimulus_template',
description='test column',
category='stimuli',
col_cls=TimeSeriesReferenceVectorData)

def test_add_row_with_no_stimulus_template_when_stimulus_template_column_exists(self):
ir = IntracellularRecordingsTable()
ir.add_recording(electrode=self.electrode,
stimulus=self.stimulus,
response=self.response,
stimulus_template=self.stimulus,
id=np.int64(10))

# add row with only stimulus when stimulus template column already exists
ir.add_recording(electrode=self.electrode,
stimulus=self.stimulus,
id=np.int64(20))
# add row with only response when stimulus template column already exists
ir.add_recording(electrode=self.electrode,
response=self.stimulus,
id=np.int64(30))

def test_add_column(self):
ir = IntracellularRecordingsTable()
ir.add_recording(
Expand Down

0 comments on commit fb60a07

Please sign in to comment.