Skip to content

Commit

Permalink
tell()
Browse files Browse the repository at this point in the history
  • Loading branch information
vidstige committed Jan 21, 2024
1 parent 29eabee commit 5ba7047
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ar/substream.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ def read(self, n=None):

def close(self):
pass

def tell(self) -> int:
return self.position
11 changes: 11 additions & 0 deletions ar/tests/test_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ def test_seek_basic():
assert file0.read(3) == 'ell'


def test_tell():
with ARCHIVE.open('rb') as f:
archive = Archive(f)
file0 = archive.open('file0.txt')
assert file0.tell() == 0
file0.read(2)
assert file0.tell() == 2
file0.read()
assert file0.tell() == 5


def test_open_missing_path():
with ARCHIVE.open('rb') as f:
archive = Archive(f)
Expand Down

0 comments on commit 5ba7047

Please sign in to comment.