def test_seek_to_tell(): fileobj = StringIO('this is a cool test') stream = LimitingStream(fileobj, 3) stream.seek(stream.tell()) assert stream.read(4) == 'thi' assert 3 == stream.tell()
def test_seek_withlimit(): fileobj = StringIO('this is a cool test') stream = LimitingStream(fileobj, 3) stream.seek(2) assert stream.read(2) == 'i' assert 3 == stream.tell()
def test_seek_pastlimit(): fileobj = StringIO('this is a cool test') stream = LimitingStream(fileobj, 3) stream.seek(4) assert stream.read(1) == '' assert 3 == stream.tell()
def test_seek(): fileobj = StringIO('this is a cool test') stream = LimitingStream(fileobj) stream.seek(2) assert stream.read(2) == 'is' assert 4 == stream.tell()
def test_seek_to_tell(): fileobj = BytesIO(b"this is a cool test") stream = LimitingStream(fileobj, 3) stream.seek(stream.tell()) assert stream.read(4) == b"thi" assert 3 == stream.tell()
def test_seek_pastlimit(): fileobj = BytesIO(b"this is a cool test") stream = LimitingStream(fileobj, 3) stream.seek(4) assert stream.read(1) == b"" assert 3 == stream.tell()
def test_seek_withlimit(): fileobj = BytesIO(b"this is a cool test") stream = LimitingStream(fileobj, 3) stream.seek(2) assert stream.read(2) == b"i" assert 3 == stream.tell()
def test_seek(): fileobj = BytesIO(b"this is a cool test") stream = LimitingStream(fileobj) stream.seek(2) assert stream.read(2) == b"is" assert 4 == stream.tell()