diff --git a/testsuite/pytests/sli2py_regressions/test_issue_708.py b/testsuite/pytests/sli2py_regressions/test_issue_708.py new file mode 100644 index 0000000000..5495b22e31 --- /dev/null +++ b/testsuite/pytests/sli2py_regressions/test_issue_708.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- +# +# test_issue_708.py +# +# This file is part of NEST. +# +# Copyright (C) 2004 The NEST Initiative +# +# NEST is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# NEST is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with NEST. If not, see . +""" +Regression test for Issue #708 (GitHub). + +This test ensures that CopyModel works with connection types that use secondary events. +""" + +import nest +import pytest + + +@pytest.mark.skipif_without_gsl +def test_copymodel_with_secondary_events(): + """ + Test that CopyModel works with connection types that use secondary events. + """ + nest.ResetKernel() + + neuron_in = nest.Create("hh_psc_alpha_gap") + neuron_out1 = nest.Create("hh_psc_alpha_gap") + neuron_out2 = nest.Create("hh_psc_alpha_gap") + vm1 = nest.Create("voltmeter") + vm2 = nest.Create("voltmeter") + + nest.CopyModel("gap_junction", "syn0") + nest.CopyModel("gap_junction", "syn1") + + nest.SetStatus(neuron_in, {"I_e": 200.0}) + nest.SetStatus(vm1, {"interval": 1.0}) + nest.SetStatus(vm2, {"interval": 1.0}) + + nest.Connect( + neuron_in, + neuron_out1, + conn_spec={"rule": "one_to_one", "make_symmetric": True}, + syn_spec={"synapse_model": "syn0", "weight": 10.0}, + ) + + nest.Connect( + neuron_in, + neuron_out2, + conn_spec={"rule": "one_to_one", "make_symmetric": True}, + syn_spec={"synapse_model": "syn1", "weight": 10.0}, + ) + + nest.Connect(vm1, neuron_out1) + nest.Connect(vm2, neuron_out2) + + nest.Simulate(10.0) + + # Check that neuron_out1 received the input + events_vm1 = nest.GetStatus(vm1, "events")[0] + V_m_vm1 = events_vm1["V_m"] + assert V_m_vm1[8] > -6.960401e01 + + # Check that neuron_out2 received the input + events_vm2 = nest.GetStatus(vm2, "events")[0] + V_m_vm2 = events_vm2["V_m"] + assert V_m_vm2[8] > -6.960401e01 diff --git a/testsuite/regressiontests/issue-708.sli b/testsuite/regressiontests/issue-708.sli deleted file mode 100644 index bf893f93d3..0000000000 --- a/testsuite/regressiontests/issue-708.sli +++ /dev/null @@ -1,90 +0,0 @@ -/* - * issue-708.sli - * - * This file is part of NEST. - * - * Copyright (C) 2004 The NEST Initiative - * - * NEST is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * NEST is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with NEST. If not, see . - * - */ - - - /** @BeginDocumentation -Name: testsuite::issue-708 - -Synopsis: (issue-708) run -> NEST exits if test fails - -Description: -This test ensures that CopyModel works with connection -types which use secondary events. - -Author: Jan Hahne -FirstVersion: April 2017 -SeeAlso: -*/ - -(unittest) run -/unittest using - -% The following test needs the model hh_psc_alpha_gap, so -% this test should only run if we have GSL -skip_if_without_gsl - -{ - ResetKernel - - /hh_psc_alpha_gap Create /neuron_in Set - /hh_psc_alpha_gap Create /neuron_out1 Set - /hh_psc_alpha_gap Create /neuron_out2 Set - /voltmeter Create /vm1 Set - /voltmeter Create /vm2 Set - - /gap_junction /syn0 CopyModel - /gap_junction /syn1 CopyModel - - neuron_in << /I_e 200.0 >> SetStatus - vm1 << /interval 1.0 >> SetStatus - vm2 << /interval 1.0 >> SetStatus - - neuron_in neuron_out1 - << /rule /one_to_one /make_symmetric true >> - << /synapse_model /syn0 /weight 10.0 >> - Connect - - neuron_in neuron_out2 - << /rule /one_to_one /make_symmetric true >> - << /synapse_model /syn1 /weight 10.0 >> - Connect - - vm1 neuron_out1 Connect - vm2 neuron_out2 Connect - - 10 Simulate - - % check that neuron_out1 received the input - % -6.960401e+01 is the resting potential - vm1 /events get /V_m get 8 get - -6.960401e+01 gt - - % check that neuron_out2 received the input - % -6.960401e+01 is the resting potential - vm2 /events get /V_m get 8 get - -6.960401e+01 gt - - and -} -assert_or_die - -endusing