Skip to content

Commit

Permalink
Fix and test c10.C10.__repr__().
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenny Koller committed Apr 15, 2022
1 parent 3bc9431 commit 77da2a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chapter10/c10.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __next__(self):
self.file.seek(pos + 1)

def __repr__(self):
return '<C10: {}>'.format(os.path.basename(self.file.name))
return '<C10: {}>'.format(os.path.basename(self.file.io.name))

def __iter__(self):
return self
5 changes: 5 additions & 0 deletions tests/unit/test_c10.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ def test_next():
def test_next_stop():
with pytest.raises(StopIteration):
next(c10.C10(Mock(read=Mock(side_effect=EOFError))))

def test_str_repr():
c = c10.C10(SAMPLE)
repr(c)
str(c)

0 comments on commit 77da2a7

Please sign in to comment.