示例#1
0
文件: test_core.py 项目: jdmcbr/logpy
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))) == ()
示例#2
0
文件: test_core.py 项目: jdmcbr/logpy
def test_bindstar_evalt():
    x = var('x')
    stream = bindstar(({},), success, (eq, x, 1))
    assert tuple(stream) == ({x: 1},)