-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2917 from heplesser/transport-459
Port ticket-459.sli to Pytest and fix name for ticket_754.py
- Loading branch information
Showing
3 changed files
with
59 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
2 changes: 1 addition & 1 deletion
2
.../pytests/sli2py_regressions/ticket_754.py → ...sts/sli2py_regressions/test_ticket_754.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
# | ||
|
This file was deleted.
Oops, something went wrong.