diff --git a/chapter10/c10.py b/chapter10/c10.py index 1b1e022..2dc9ae7 100755 --- a/chapter10/c10.py +++ b/chapter10/c10.py @@ -98,7 +98,7 @@ def __next__(self): self.file.seek(pos + 1) def __repr__(self): - return ''.format(os.path.basename(self.file.name)) + return ''.format(os.path.basename(self.file.io.name)) def __iter__(self): return self diff --git a/tests/unit/test_c10.py b/tests/unit/test_c10.py index e33db7a..c5ec397 100755 --- a/tests/unit/test_c10.py +++ b/tests/unit/test_c10.py @@ -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) \ No newline at end of file