Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions testsuite/pytests/sli2py_regressions/test_ticket_737.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-
#
# test_ticket_737.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 <http://www.gnu.org/licenses/>.

import nest
import pytest

"""
Regression test for Ticket #737.

Test ported from SLI regression test
Ensure that stimulation devices can only be connected with a single synapse type.
"""


# Get all viable stimulator models
SKIP_LIST = ["step_rate_generator"]
stimulators = [
m for m in nest.node_models if m not in SKIP_LIST and nest.GetDefaults(m).get("element_type") == "stimulator"
]


@pytest.fixture(params=stimulators)
def stimulator_and_neuron(request):
stim_model = request.param

nest.ResetKernel()
stim = nest.Create(stim_model)
n = nest.Create("iaf_psc_alpha")

yield stim, n


def test_ticket_737_all_static(stimulator_and_neuron):
"""Confirm we can connect multiple times with static_synapse."""

stim, n = stimulator_and_neuron

nest.Connect(stim, n, "all_to_all", syn_spec="static_synapse")
nest.Connect(stim, n, "all_to_all", syn_spec="static_synapse")


def test_ticket_737_user_defined(stimulator_and_neuron):
"""Confirm we can connect multiple times with user-defined synapse model."""

stim, n = stimulator_and_neuron

synmodel = f"{stim.model}_syn"
nest.CopyModel("static_synapse", synmodel)
nest.Connect(stim, n, "all_to_all", syn_spec=synmodel)
nest.Connect(stim, n, "all_to_all", syn_spec=synmodel)


def test_ticket_737_break_on_different_types(stimulator_and_neuron):
"""Confirm NEST raises error if trying to connect one generator with different synpase models."""

stim, n = stimulator_and_neuron

synmodel = f"{stim.model}_syn"
nest.CopyModel("static_synapse", synmodel)
nest.Connect(stim, n, "all_to_all", syn_spec="static_synapse")

with pytest.raises(nest.kernel.NESTError, match="IllegalConnection"):
nest.Connect(stim, n, "all_to_all", syn_spec=synmodel)
99 changes: 0 additions & 99 deletions testsuite/regressiontests/ticket-737.sli

This file was deleted.

6 changes: 3 additions & 3 deletions testsuite/summarize_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
expected_num_tests = {
"01 basetests": 6,
"02 selftests": 8,
"03 unittests": 27,
"04 regressiontests": 45, # does not include the two python-dependent tests
"05 mpitests": 77,
"03 unittests": 1, # set to 1 to avoid complications during porting to Pytest
"04 regressiontests": 1, # set to 1 to avoid complications during porting to Pytest
"05 mpitests": 1, # set to 1 to avoid complications during porting to Pytest
"06 musictests": 1,
"07 pynesttests": 3719, # without thread-dependent cases
"07 pynesttests mpi 2": (230, 172), # first case without thread-dependent cases
Expand Down
Loading