Skip to content

Commit

Permalink
Seek should return the current position (#79)
Browse files Browse the repository at this point in the history
* Seek should return the current position

* Add changelog
  • Loading branch information
xhochy authored and fmarczin committed Jul 11, 2018
1 parent 392abb4 commit 32c83b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
*********

0.11.10
=======

* Azure files handles now correctly implement seek and return the new position.

0.11.9
======
* Add option to set the checksum for Azure blobs.
Expand Down
1 change: 1 addition & 0 deletions simplekv/net/azurestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def seek(self, offset, whence=0):
if self.size + offset < 0:
raise IOError('seek would move position outside the file')
self.pos = self.size + offset
return self.pos

def seekable(self):
return True
Expand Down
4 changes: 2 additions & 2 deletions tests/basic_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ def test_open_seek_and_tell_empty_value(self, store, key):
store.put(key, value)
ok = store.open(key)
assert ok.seekable()
ok.seek(10)
assert ok.seek(10) == 10
assert ok.tell() == 10
ok.seek(-6, 1)
assert ok.seek(-6, 1) == 4
assert ok.tell() == 4
with pytest.raises(IOError):
ok.seek(-1, 0)
Expand Down

0 comments on commit 32c83b3

Please sign in to comment.