Skip to content

Commit

Permalink
Merge pull request #2917 from heplesser/transport-459
Browse files Browse the repository at this point in the history
Port ticket-459.sli to Pytest and fix name for ticket_754.py
  • Loading branch information
heplesser authored Sep 12, 2023
2 parents f565c96 + 5e845df commit 270995a
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 105 deletions.
58 changes: 58 additions & 0 deletions testsuite/pytests/sli2py_regressions/test_ticket_459.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
#
# test_ticket_459.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/>.

"""
Test that changing E_L in any neuron with this parameter leaves all other parameters unchanged.
"""

import pytest

import nest


@pytest.fixture(autouse=True)
def reset():
nest.ResetKernel()


# Collect all models with E_L parameter.
# Skip gif_cond_exp_multisynapse because it has numpy array parameter making check below difficult.
models_with_EL = [model for model in nest.node_models if "E_L" in nest.GetDefaults(model)]
models_with_EL.remove("gif_cond_exp_multisynapse")


@pytest.mark.parametrize("model", models_with_EL)
def test_clean_EL_change(model):
nrn = nest.Create(model)
orig_params = nest.GetStatus(nrn)[0]

EL_orig = orig_params["E_L"]
EL_new = EL_orig + 0.7
nrn.E_L = EL_new

# Confirm E_L has been changed.
assert nrn.get("E_L") == EL_new

# Confirm all other parameters are equal to original values.
new_params = nest.GetStatus(nrn)[0]
del orig_params["E_L"]
del new_params["E_L"]
assert new_params == orig_params
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# ticket_754.py
# test_ticket_754.py
#
# This file is part of NEST.
#
Expand Down
104 changes: 0 additions & 104 deletions testsuite/regressiontests/ticket-459.sli

This file was deleted.

0 comments on commit 270995a

Please sign in to comment.