Skip to content
Closed
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
27 changes: 27 additions & 0 deletions brian2/tests/test_synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3730,6 +3730,32 @@ def test_setting_from_weight_matrix():
assert all(syn.w[i, j] == weights[i, j])


def test_synapses_cython_codegen_target_runs():

old_target = prefs.codegen.target
prefs.codegen.target = "cython"

try:
start_scope()

G = NeuronGroup(
2,
"v : 1",
threshold="v > 1",
reset="v = 0",
)

S = Synapses(G, G, on_pre="v_post += 1")
S.connect(i=0, j=1)

G.v = [2, 0]
run(1 * ms)

assert_allclose(G.v[:], [0, 1])
finally:
prefs.codegen.target = old_target


if __name__ == "__main__":
SANITY_CHECK_PERMUTATION_ANALYSIS_EXAMPLE = True
# prefs.codegen.target = 'numpy'
Expand Down Expand Up @@ -3832,5 +3858,6 @@ def test_setting_from_weight_matrix():
test_synaptic_subgroups()
test_incorrect_connect_N_incoming_outgoing()
test_setting_from_weight_matrix()


print("Tests took", time.time() - start)
Loading