'Test seek() and tell().
The initial position when these tests run is 0.
Args:
offset: The offset to pass to .seek().
whence: The whence argument to pass to .seek().
pos: The expected position after seeking.
data: The expected data to read after seeking.
raising: Whether seeking should raise OSError.'

@pytest.mark.qt_log_ignore('^QBuffer::seek:    Invalid    pos:')
@pytest.mark.parametrize('offset,    whence,    pos,    data,    raising', [(0, io.SEEK_SET, 0, '1234567890', False), (42, io.SEEK_SET, 0, '1234567890', True), (8, io.SEEK_CUR, 8, '90', False), ((-5), io.SEEK_CUR, 0, '1234567890', True), ((-2), io.SEEK_END, 8, '90', False), (2, io.SEEK_END, 0, '1234567890', True), (0, io.SEEK_END, 10, '', False)])
def test_seek_tell(self, pyqiodev, offset, whence, pos, data, raising):

    with pyqiodev.open(QIODevice.WriteOnly) as f:
        f.write('1234567890')
    pyqiodev.open(QIODevice.ReadOnly)
    if raising:
        with pytest.raises(OSError, match='seek    failed!'):
            pyqiodev.seek(offset, whence)
    else:
        pyqiodev.seek(offset, whence)
    assert (pyqiodev.tell() == pos)
    assert (pyqiodev.read() == data)
