From eb5f4e762f2ede2cb6f8549508e2ab2268c31c1f Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Fri, 25 Oct 2024 15:01:25 +0200 Subject: [PATCH] Remove tests for not `vectorized` code. --- .../function/artificial_functions.mod | 10 ----- test/usecases/function/non_threadsafe.mod | 38 ---------------- .../function/point_non_threadsafe.mod | 38 ---------------- test/usecases/function/test_functions.py | 4 -- test/usecases/global/non_threadsafe.mod | 43 ------------------- test/usecases/global/test_non_threadsafe.py | 33 -------------- 6 files changed, 166 deletions(-) delete mode 100644 test/usecases/function/non_threadsafe.mod delete mode 100644 test/usecases/function/point_non_threadsafe.mod delete mode 100644 test/usecases/global/non_threadsafe.mod delete mode 100644 test/usecases/global/test_non_threadsafe.py diff --git a/test/usecases/function/artificial_functions.mod b/test/usecases/function/artificial_functions.mod index e684591f8..ee25e3474 100644 --- a/test/usecases/function/artificial_functions.mod +++ b/test/usecases/function/artificial_functions.mod @@ -22,13 +22,3 @@ INITIAL { x = 1.0 gbl = 42.0 } - -: A LINEAR block makes a MOD file not VECTORIZED. -STATE { - z -} - -LINEAR lin { - ~ z = 2 -} - diff --git a/test/usecases/function/non_threadsafe.mod b/test/usecases/function/non_threadsafe.mod deleted file mode 100644 index ee1789a12..000000000 --- a/test/usecases/function/non_threadsafe.mod +++ /dev/null @@ -1,38 +0,0 @@ -NEURON { - SUFFIX non_threadsafe - RANGE x - GLOBAL gbl -} - -ASSIGNED { - gbl - v - x -} - -FUNCTION x_plus_a(a) { - x_plus_a = x + a -} - -FUNCTION v_plus_a(a) { - v_plus_a = v + a -} - -FUNCTION identity(v) { - identity = v -} - -INITIAL { - x = 1.0 - gbl = 42.0 -} - -: A LINEAR block makes a MOD file not VECTORIZED. -STATE { - z -} - -LINEAR lin { - ~ z = 2 -} - diff --git a/test/usecases/function/point_non_threadsafe.mod b/test/usecases/function/point_non_threadsafe.mod deleted file mode 100644 index 13ce35cca..000000000 --- a/test/usecases/function/point_non_threadsafe.mod +++ /dev/null @@ -1,38 +0,0 @@ -NEURON { - POINT_PROCESS point_non_threadsafe - RANGE x - GLOBAL gbl -} - -ASSIGNED { - gbl - v - x -} - -FUNCTION x_plus_a(a) { - x_plus_a = x + a -} - -FUNCTION v_plus_a(a) { - v_plus_a = v + a -} - -FUNCTION identity(v) { - identity = v -} - -INITIAL { - x = 1.0 - gbl = 42.0 -} - -: A LINEAR block makes a MOD file not VECTORIZED. -STATE { - z -} - -LINEAR lin { - ~ z = 2 -} - diff --git a/test/usecases/function/test_functions.py b/test/usecases/function/test_functions.py index 046cb8555..b033a958f 100644 --- a/test/usecases/function/test_functions.py +++ b/test/usecases/function/test_functions.py @@ -31,18 +31,14 @@ def check_callable(get_instance, has_voltage=True): s.nseg = nseg s.insert("functions") -s.insert("non_threadsafe") coords = [(0.5 + k) * 1.0 / nseg for k in range(nseg)] values = [0.1 + k for k in range(nseg)] point_processes = {x: h.point_functions(s(x)) for x in coords} -point_non_threadsafe = {x: h.point_non_threadsafe(s(x)) for x in coords} art_cells = {x: h.art_functions() for x in coords} check_callable(lambda x: s(x).functions) -check_callable(lambda x: s(x).non_threadsafe) check_callable(lambda x: point_processes[x]) -check_callable(lambda x: point_non_threadsafe[x]) check_callable(lambda x: art_cells[x], has_voltage=False) diff --git a/test/usecases/global/non_threadsafe.mod b/test/usecases/global/non_threadsafe.mod deleted file mode 100644 index 54eb96aed..000000000 --- a/test/usecases/global/non_threadsafe.mod +++ /dev/null @@ -1,43 +0,0 @@ -NEURON { - SUFFIX non_threadsafe - GLOBAL gbl -} - -LOCAL top_local - -PARAMETER { - parameter = 41.0 -} - -ASSIGNED { - gbl -} - -FUNCTION get_gbl() { - get_gbl = gbl -} - -FUNCTION get_top_local() { - get_top_local = top_local -} - -FUNCTION get_parameter() { - get_parameter = parameter -} - -INITIAL { - gbl = 42.0 - top_local = 43.0 -} - -: A LINEAR block makes the MOD file not thread-safe and not -: vectorized. We don't otherwise care about anything below -: this comment. -STATE { - z -} - -LINEAR lin { - ~ z = 2 -} - diff --git a/test/usecases/global/test_non_threadsafe.py b/test/usecases/global/test_non_threadsafe.py deleted file mode 100644 index fcd413fb7..000000000 --- a/test/usecases/global/test_non_threadsafe.py +++ /dev/null @@ -1,33 +0,0 @@ -import numpy as np - -from neuron import h, gui -from neuron.units import ms - - -def test_non_threadsafe(): - nseg = 1 - - s = h.Section() - s.insert("non_threadsafe") - s.nseg = nseg - - h.finitialize() - - instance = s(0.5).non_threadsafe - - # Check INITIAL values. - assert instance.get_parameter() == 41.0 - assert instance.get_gbl() == 42.0 - assert instance.get_top_local() == 43.0 - - # Check reassigning a value. Top LOCAL variables - # are not exposed to HOC/Python. - h.parameter_non_threadsafe = 32.1 - h.gbl_non_threadsafe = 33.2 - - assert instance.get_parameter() == 32.1 - assert instance.get_gbl() == 33.2 - - -if __name__ == "__main__": - test_non_threadsafe()