예제 #1
0
def test_zip_first():
    a = Stream()
    b = Stream()
    c = a.zip(b).starmap(op.sub)
    d = a.zip(b, first=True).starmap(op.add)
    L = c.union(d).sink_to_list()

    a.emit(1)
    b.emit(1)
    assert L == [2, 0]
예제 #2
0
def test_combine_latest_first():
    a = Stream()
    b = Stream()
    c = a.zip(b)

    z = c.starmap(op.add)
    zz = z.combine_latest(b, emit_on=0, first=b)
    L = zz.sink_to_list()

    a.emit(1)
    b.emit(1)
    assert len(L) == 1
예제 #3
0
 def make_c():
     out_a = Stream()
     out_b = Stream()
     out_c = out_a.zip(out_b).map(sum)
     return {"out_a": out_a, "out_b": out_b, "out_c": out_c}