diff --git a/ar/substream.py b/ar/substream.py index f08c077..d746232 100644 --- a/ar/substream.py +++ b/ar/substream.py @@ -30,3 +30,6 @@ def read(self, n=None): def close(self): pass + + def tell(self) -> int: + return self.position diff --git a/ar/tests/test_linux.py b/ar/tests/test_linux.py index 772e39f..6feca1a 100644 --- a/ar/tests/test_linux.py +++ b/ar/tests/test_linux.py @@ -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)