From 3779a8293a3f785247bf51c47e07c4044c42bfb6 Mon Sep 17 00:00:00 2001 From: Jessica Mitchell Date: Tue, 22 Apr 2025 14:08:16 +0200 Subject: [PATCH 1/2] sli2py -mistral --- .../sli2py_regressions/test_issue_707.py | 36 ++++++++++ testsuite/regressiontests/issue-707.sli | 68 ------------------- 2 files changed, 36 insertions(+), 68 deletions(-) create mode 100644 testsuite/pytests/sli2py_regressions/test_issue_707.py delete mode 100644 testsuite/regressiontests/issue-707.sli diff --git a/testsuite/pytests/sli2py_regressions/test_issue_707.py b/testsuite/pytests/sli2py_regressions/test_issue_707.py new file mode 100644 index 0000000000..e9505527e4 --- /dev/null +++ b/testsuite/pytests/sli2py_regressions/test_issue_707.py @@ -0,0 +1,36 @@ +""" +Regression test for Issue #707 (GitHub). + +This test ensures that the weight of gap junctions can be recorded with the weight_recorder. +""" + +import nest +import pytest + + +@pytest.mark.skipif_without_gsl +def test_gap_junction_weight_recording(): + """ + Test that the weight of gap junctions can be recorded with the weight_recorder. + """ + nest.ResetKernel() + + neuron_in = nest.Create("hh_psc_alpha_gap") + neuron_out = nest.Create("hh_psc_alpha_gap") + wr = nest.Create("weight_recorder") + + nest.SetDefaults("gap_junction", {"weight_recorder": wr}) + + nest.Connect( + neuron_in, + neuron_out, + conn_spec={"rule": "one_to_one", "make_symmetric": True}, + syn_spec={"synapse_model": "gap_junction", "weight": 2.0}, + ) + + nest.Simulate(10.0) + + events = nest.GetStatus(wr, "events")[0] + weights = events["weights"] + + assert weights[0] == 2.0 diff --git a/testsuite/regressiontests/issue-707.sli b/testsuite/regressiontests/issue-707.sli deleted file mode 100644 index afb4962ad4..0000000000 --- a/testsuite/regressiontests/issue-707.sli +++ /dev/null @@ -1,68 +0,0 @@ -/* - * issue-707.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-707 - -Synopsis: (issue-707) run -> NEST exits if test fails - -Description: -This test ensures that the weight of gap junctions can -be recorded with the weight_recorder (thus that SecondaryEvents -have a properly set time stamp). - -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_out Set - /weight_recorder Create /wr Set - - /gap_junction << /weight_recorder wr >> SetDefaults - - neuron_in neuron_out - << /rule /one_to_one /make_symmetric true >> - << /synapse_model /gap_junction /weight 2.0 >> - Connect - - 10 Simulate - - wr /events get /weights get 1 get - - 2.0 eq -} -assert_or_die - -endusing From fd197c6106f9a14b44b46986f8e3c5937a5bc45c Mon Sep 17 00:00:00 2001 From: Jessica Mitchell Date: Tue, 22 Apr 2025 14:54:55 +0200 Subject: [PATCH 2/2] header --- .../sli2py_regressions/test_issue_707.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/testsuite/pytests/sli2py_regressions/test_issue_707.py b/testsuite/pytests/sli2py_regressions/test_issue_707.py index e9505527e4..b910efd582 100644 --- a/testsuite/pytests/sli2py_regressions/test_issue_707.py +++ b/testsuite/pytests/sli2py_regressions/test_issue_707.py @@ -1,3 +1,23 @@ +# -*- coding: utf-8 -*- +# +# test_issue_707.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 #707 (GitHub).