MCPcopy
hub / github.com/hyperopt/hyperopt / test_kwswitch

Function test_kwswitch

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

Source from the content-addressed store, hash-verified

221
222
223def test_kwswitch():
224 i = Literal()
225 ab = scope.kwswitch(i, k1="a", k2="b", err=scope.Raise(Exception))
226 assert rec_eval(ab, memo={i: "k1"}) == "a"
227 assert rec_eval(ab, memo={i: "k2"}) == "b"
228 assert_raises(Exception, rec_eval, ab, memo={i: "err"})
229
230
231def test_recursion():

Callers

nothing calls this directly

Calls 2

LiteralClass · 0.90
rec_evalFunction · 0.90

Tested by

no test coverage detected