def test_scalar_subexpression(): G = NeuronGroup(10, '''dv/dt = freq : 1 freq : Hz (shared) number : 1 (shared) array : 1 sub = freq + number*Hz : Hz (shared)''') G.freq = 100*Hz G.number = 50 assert G.sub[:] == 150*Hz assert_raises(SyntaxError, lambda: NeuronGroup(10, '''dv/dt = freq : 1 freq : Hz (shared) array : 1 sub = freq + array*Hz : Hz (shared)''')) # A scalar subexpresion cannot refer to implicitly vectorized functions assert_raises(SyntaxError, lambda: NeuronGroup(10, 'sub = rand() : 1 (shared)'))
def test_scalar_subexpression(): G = NeuronGroup(10, '''dv/dt = freq : 1 freq : Hz (shared) number : 1 (shared) array : 1 sub = freq + number*Hz : Hz (shared)''') G.freq = 100*Hz G.number = 50 assert G.sub[:] == 150*Hz assert_raises(SyntaxError, lambda: NeuronGroup(10, '''dv/dt = freq : 1 freq : Hz (shared) array : 1 sub = freq + array*Hz : Hz (shared)''')) # A scalar subexpresion cannot refer to implicitly vectorized functions assert_raises(SyntaxError, lambda: NeuronGroup(10, 'sub = rand() : 1 (shared)'))