MCPcopy
hub / github.com/hyperopt/hyperopt / test_eval_arithmetic

Function test_eval_arithmetic

hyperopt/pyll/tests/test_base.py:153–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

151
152
153def test_eval_arithmetic():
154 a, b, c = as_apply((2, 3, 4))
155
156 assert (a + b).eval() == 5
157 assert (a + b + c).eval() == 9
158 assert (a + b + 1 + c).eval() == 10
159
160 assert (a * b).eval() == 6
161 assert (a * b * c * (-1)).eval() == -24
162
163 assert (a - b).eval() == -1
164 assert (a - b * c).eval() == -10
165
166 assert (a // b).eval() == 0 # int div
167 assert (b // a).eval() == 1 # int div
168 assert (c / a).eval() == 2
169 assert (4 / a).eval() == 2
170 assert (a / 4.0).eval() == 0.5
171
172
173def test_bincount():

Callers

nothing calls this directly

Calls 2

as_applyFunction · 0.90
evalMethod · 0.45

Tested by

no test coverage detected