Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit b64d69b

Browse files
author
Jaquier Aurélien Tristan
committed
add test for isolated protocol run
1 parent 64d7fd4 commit b64d69b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

bluepyopt/tests/test_ephys/test_protocols.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,57 @@ def test_sweepprotocol_run_unisolated():
365365
dummy_cell.destroy(sim=nrn_sim)
366366

367367

368+
@pytest.mark.unit
369+
def test_sweepprotocol_run_isolated():
370+
"""ephys.protocols: Test SweepProtocol isolated run"""
371+
372+
nrn_sim = ephys.simulators.NrnSimulator(dt=0.1)
373+
dummy_cell = dummycells.DummyCellModel1()
374+
soma_loc = ephys.locations.NrnSeclistCompLocation(
375+
name='soma_loc',
376+
seclist_name='somatic',
377+
sec_index=0,
378+
comp_x=.5)
379+
unknown_loc = ephys.locations.NrnSomaDistanceCompLocation(
380+
name='unknown_loc',
381+
seclist_name='somatic',
382+
soma_distance=100)
383+
384+
rec_soma = ephys.recordings.CompRecording(
385+
name='soma.v',
386+
location=soma_loc,
387+
variable='v')
388+
rec_unknown = ephys.recordings.CompRecording(
389+
name='unknown.v',
390+
location=unknown_loc,
391+
variable='v')
392+
393+
stim = ephys.stimuli.NrnSquarePulse(
394+
step_amplitude=0.0,
395+
step_delay=0.0,
396+
step_duration=50,
397+
total_duration=50,
398+
location=soma_loc)
399+
400+
protocol = ephys.protocols.SweepProtocol(
401+
name='prot',
402+
stimuli=[stim],
403+
recordings=[rec_soma, rec_unknown])
404+
405+
responses = protocol.run(
406+
cell_model=dummy_cell,
407+
param_values={},
408+
sim=nrn_sim,
409+
isolate=True)
410+
411+
assert 'soma.v' in responses
412+
assert 'unknown.v' in responses
413+
assert responses['unknown.v'] is None
414+
415+
protocol.destroy(sim=nrn_sim)
416+
dummy_cell.destroy(sim=nrn_sim)
417+
418+
368419
@pytest.mark.unit
369420
def test_nrnsimulator_exception():
370421
"""ephys.protocols: test if protocol raise nrn sim exception"""

0 commit comments

Comments
 (0)