def membero(x, coll): """ Goal such that x is an item of coll """ if not isvar(x) and not isvar(coll): if x in coll: return success return (lany,) + tuple((eq, x, item) for item in coll) if isvar(x) and not isvar(coll): return (lany,) + tuple((eq, x, item) for item in coll) raise EarlyGoalError()
def test_isvar(): assert not isvar(3) assert isvar(var(3))
def test_context_manager(): with variables(1): assert isvar(1) assert not isvar(1)