Exemple #1
0
def test_bindstar():
    x = var('x')
    stream = tuple({x: i} for i in range(5))
    success = lambda s: (s,)
    assert tuple(bindstar(stream, success)) == stream
    assert tuple(bindstar(stream, eq(x, 3))) == ({x: 3},)
    assert tuple(bindstar(stream, success, eq(x, 3))) == ({x: 3},)
    assert tuple(bindstar(stream, eq(x, 2), eq(x, 3))) == ()
Exemple #2
0
def test_bindstar_evalt():
    x = var('x')
    stream = bindstar(({},), success, (eq, x, 1))
    assert tuple(stream) == ({x: 1},)