def test_exact_page(): stream = streams.wrap(iter([0, 1, 2, 3])).paginate(2) layers = 0 for l in stream: utils.testWrapped(l) values = 0 for v in l: assert v == values + (2 * layers) values += 1 assert values == 2 layers += 1 assert layers == 2 utils.testEmpty(stream)
def test_empty(): stream = streams.wrap(iter([])) utils.testEmpty(stream.filter(lambda x: x % 2 == 1))
def test_empty(): stream = streams.wrap(iter([])).paginate(1) utils.testEmpty(stream)
def test_empty(): stream = streams.wrap(iter([])) utils.testEmpty(stream.map(str))
def test_empty(): stream = streams.wrap(iter([])) utils.testEmpty(stream.flatten())
def test_zero(): sample_list = [1, 2, 3, 4, 5] stream = streams.wrap(iter(sample_list)) utils.testEmpty(stream.limit(0))
def test_empty(): stream = streams.wrap(iter([])) utils.testEmpty(stream.limit(4))
def test_empty(): stream = streams.wrap(iter([])) finite = streams.wrap([1, 2, 3]) utils.testEmpty(stream.zip(finite)) utils.testEmpty(finite.zip(stream))