Skip to content

Commit 664f582

Browse files
committed
Adapted tests to pynest-ng and modernized
1 parent 125dad1 commit 664f582

File tree

4 files changed

+17
-33
lines changed

4 files changed

+17
-33
lines changed

testsuite/pytests/sli2py_regressions/test_issue_659.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_run_without_prepare():
3333
Test that calling Run without Prepare results in an error.
3434
"""
3535
nest.ResetKernel()
36-
with pytest.raises(nest.kernel.NESTError):
36+
with pytest.raises(nest.NESTError):
3737
nest.Run(10.0)
3838

3939

testsuite/pytests/sli2py_regressions/test_issue_707.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,4 @@ def test_gap_junction_weight_recording():
5050

5151
nest.Simulate(10.0)
5252

53-
events = nest.GetStatus(wr, "events")[0]
54-
weights = events["weights"]
55-
56-
assert weights[0] == 2.0
53+
assert wr.get("events", "weights")[0] == 2.0

testsuite/pytests/sli2py_regressions/test_issue_708.py

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,46 +33,33 @@ def test_copymodel_with_secondary_events():
3333
"""
3434
Test that CopyModel works with connection types that use secondary events.
3535
"""
36-
nest.ResetKernel()
3736

38-
neuron_in = nest.Create("hh_psc_alpha_gap")
39-
neuron_out1 = nest.Create("hh_psc_alpha_gap")
40-
neuron_out2 = nest.Create("hh_psc_alpha_gap")
41-
vm1 = nest.Create("voltmeter")
42-
vm2 = nest.Create("voltmeter")
37+
neuron_in = nest.Create("hh_psc_alpha_gap", params={"I_e": 200.0})
38+
neurons_out = nest.Create("hh_psc_alpha_gap", n=2)
4339

44-
nest.CopyModel("gap_junction", "syn0")
45-
nest.CopyModel("gap_junction", "syn1")
46-
47-
nest.SetStatus(neuron_in, {"I_e": 200.0})
48-
nest.SetStatus(vm1, {"interval": 1.0})
49-
nest.SetStatus(vm2, {"interval": 1.0})
40+
nest.CopyModel("gap_junction", "syn0", {"weight": 5.0})
41+
nest.CopyModel("gap_junction", "syn1", {"weight": 10.0})
5042

5143
nest.Connect(
5244
neuron_in,
53-
neuron_out1,
45+
neurons_out[0],
5446
conn_spec={"rule": "one_to_one", "make_symmetric": True},
55-
syn_spec={"synapse_model": "syn0", "weight": 10.0},
47+
syn_spec={"synapse_model": "syn0"},
5648
)
5749

5850
nest.Connect(
5951
neuron_in,
60-
neuron_out2,
52+
neurons_out[1],
6153
conn_spec={"rule": "one_to_one", "make_symmetric": True},
62-
syn_spec={"synapse_model": "syn1", "weight": 10.0},
54+
syn_spec={"synapse_model": "syn1"},
6355
)
6456

65-
nest.Connect(vm1, neuron_out1)
66-
nest.Connect(vm2, neuron_out2)
57+
V_m_ini = neurons_out.V_m
6758

6859
nest.Simulate(10.0)
6960

70-
# Check that neuron_out1 received the input
71-
events_vm1 = nest.GetStatus(vm1, "events")[0]
72-
V_m_vm1 = events_vm1["V_m"]
73-
assert V_m_vm1[8] > -6.960401e01
61+
# Check that both neurons have become depolarized due to input from neuron_in
62+
assert all(neurons_out.V_m > V_m_ini)
7463

75-
# Check that neuron_out2 received the input
76-
events_vm2 = nest.GetStatus(vm2, "events")[0]
77-
V_m_vm2 = events_vm2["V_m"]
78-
assert V_m_vm2[8] > -6.960401e01
64+
# Check stronger effect on second neuron due to larger weight
65+
assert neurons_out[1].V_m > neurons_out[0].V_m

testsuite/pytests/sli2py_regressions/test_issue_735.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_issue_735(use_param_on_connect, copy_model, param_name):
4747
syn_model = "stdp_dopamine_synapse"
4848

4949
if use_param_on_connect:
50-
with pytest.raises(nest.kernel.NESTErrors.NotImplemented):
50+
with pytest.raises(nest.NESTErrors.NotImplemented):
5151
nest.Connect(
5252
n,
5353
n,
@@ -57,5 +57,5 @@ def test_issue_735(use_param_on_connect, copy_model, param_name):
5757
else:
5858
nest.Connect(n, n, syn_spec={"synapse_model": syn_model, "weight": 2.0})
5959
conns = nest.GetConnections()
60-
with pytest.raises(nest.kernel.NESTErrors.DictError):
60+
with pytest.raises(nest.NESTErrors.UnaccessedDictionaryEntry):
6161
conns.set({param_name: 1.0, "weight": 2.0})

0 commit comments

Comments
 (0)