示例#1
0
def test_MultiFile_read_all():
    from oniontree.multifile import MultiFile
    from io import BytesIO

    a = BytesIO(b'\xaa'*2)
    b = BytesIO(b'\xbb'*2)
    c = BytesIO(b'\xcc'*2)

    m = MultiFile(files=[a, b, c])

    assert m.read() == b'\xaa\xaa\xbb\xbb\xcc\xcc'
示例#2
0
def test_MultiFile_seek(start, offset, whence):
    assume(whence < 2 and offset >= 0)
    from oniontree.multifile import MultiFile
    from io import BytesIO


    a = BytesIO(b'\xaa'*2)
    b = BytesIO(b'\xbb'*2)
    c = BytesIO(b'\xcc'*2)

    m = MultiFile(files=[a, b, c])
    j = BytesIO(b'\xaa\xaa\xbb\xbb\xcc\xcc')

    m.seek(start)
    j.seek(start)

    m.seek(offset, whence)
    j.seek(offset, whence)

    assert m.read() == j.read()