Skip to content

Commit d1ed177

Browse files
convert with cursor
1 parent 31256b9 commit d1ed177

File tree

2 files changed

+64
-99
lines changed

2 files changed

+64
-99
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# test_ticket_737.py
4+
#
5+
# This file is part of NEST.
6+
#
7+
# Copyright (C) 2004 The NEST Initiative
8+
#
9+
# NEST is free software: you can redistribute it and/or modify
10+
# it under the terms of the GNU General Public License as published by
11+
# the Free Software Foundation, either version 2 of the License, or
12+
# (at your option) any later version.
13+
#
14+
# NEST is distributed in the hope that it will be useful,
15+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
# GNU General Public License for more details.
18+
#
19+
# You should have received a copy of the GNU General Public License
20+
# along with NEST. If not, see <http://www.gnu.org/licenses/>.
21+
22+
import nest
23+
import pytest
24+
25+
SKIP_LIST = ["step_rate_generator"]
26+
27+
# Get all stimulator models
28+
stimulators = [
29+
m for m in nest.node_models if m not in SKIP_LIST and nest.GetDefaults(m).get("element_type") == "stimulator"
30+
]
31+
32+
33+
@pytest.mark.parametrize("stim_model", stimulators)
34+
def test_multiple_static_synapse_connections(stim_model):
35+
"""
36+
Regression test for Ticket #737.
37+
38+
Ensure that stimulation devices can only be connected with a single synapse type.
39+
"""
40+
# First test: multiple connections with same type (static_synapse)
41+
nest.ResetKernel()
42+
stim = nest.Create(stim_model)
43+
n = nest.Create("iaf_psc_alpha")
44+
nest.Connect(stim, n, "all_to_all", syn_spec="static_synapse")
45+
nest.Connect(stim, n, "all_to_all", syn_spec="static_synapse")
46+
47+
# Second test: multiple connections of user-defined type
48+
nest.ResetKernel()
49+
stim = nest.Create(stim_model)
50+
n = nest.Create("iaf_psc_alpha")
51+
synmodel = f"{stim_model}_syn"
52+
nest.CopyModel("static_synapse", synmodel)
53+
nest.Connect(stim, n, "all_to_all", syn_spec=synmodel)
54+
nest.Connect(stim, n, "all_to_all", syn_spec=synmodel)
55+
56+
# Third test: no multiple connections with different types
57+
nest.ResetKernel()
58+
stim = nest.Create(stim_model)
59+
n = nest.Create("iaf_psc_alpha")
60+
synmodel = f"{stim_model}_syn"
61+
nest.CopyModel("static_synapse", synmodel)
62+
nest.Connect(stim, n, "all_to_all", syn_spec="static_synapse")
63+
with pytest.raises(nest.NESTError):
64+
nest.Connect(stim, n, "all_to_all", syn_spec=synmodel)

testsuite/regressiontests/ticket-737.sli

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)