def test_read():
    p = sp.Popen(args=['python', '-'], stdin=sp.PIPE, stdout=sp.PIPE)
    p.stdin.write(script)
    p.stdin.close()
    f = stream.Reader(p.stdout)

    result = list(zip(range(10), f))
    p.kill()

    j = 0
    for i, buf in result:
        assert i == j
        assert len(buf) == f.bufsize
        j += 1

    try:
        next(f)
    except __HOLE__ as e:
        assert e.args == ('timeout',)
dataset/ETHPy150Open romanz/amodem/amodem/tests/test_stream.py/test_read