Exemplo n.º 1
0
def test_compose():
    def f(it):
        for x in it:
            yield x+1
    g = dlf.compose(f, f, f)
    assert list(g(range(5))) == [3, 4, 5, 6, 7]

    reload(dlf)

    def f(s):
        def g(it):
            for x in it:
                yield x+s
        return g
    g = dlf.compose(f("a"), f("b"), f("c"), f("d"))
    assert list(g([""])) == ["abcd"]
Exemplo n.º 2
0
def test_compose():
    for sample in dlf.compose(dlf.batched(20), dlf.unbatch())(source2(100)):
        assert sample["png"].shape == (1, 1, 3), sample["png"].shape