MCPcopy Create free account
hub / github.com/vispy/vispy / test_FunctionCall

Function test_FunctionCall

vispy/visuals/shaders/tests/test_function.py:131–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129
130
131def test_FunctionCall():
132 fun = Function(transformScale)
133 fun['scale'] = '1.0'
134 fun2 = Function(transformZOffset)
135
136 # No args
137 assert_raises(TypeError, fun) # need 1 arg
138 assert_raises(TypeError, fun, 1, 2) # need 1 arg
139 call = fun('x')
140 # Test repr
141 exp = call.expression({fun: 'y'})
142 assert_equal(exp, 'y(x)')
143 # Test sig
144 assert len(call._args) == 1
145 # Test dependencies
146 assert_in(fun, call.dependencies())
147 assert_in(call._args[0], call.dependencies())
148
149 # More args
150 call = fun(fun2('foo'))
151 # Test repr
152 exp = call.expression({fun: 'y', fun2: 'z'})
153 assert_in('y(z(', exp)
154 # Test sig
155 assert len(call._args) == 1
156 call2 = call._args[0]
157 assert len(call2._args) == 1
158 # Test dependencies
159 assert_in(fun, call.dependencies())
160 assert_in(call._args[0], call.dependencies())
161 assert_in(fun2, call.dependencies())
162 assert_in(call2._args[0], call.dependencies())
163
164
165def test_Variable():

Callers

nothing calls this directly

Calls 7

FunctionClass · 0.90
assert_raisesFunction · 0.90
assert_equalFunction · 0.90
assert_inFunction · 0.90
funFunction · 0.85
dependenciesMethod · 0.80
expressionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…