Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing __repr__ to streams.EmptyStreamReader #6916

Merged
merged 1 commit into from Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/6916.bugfix
@@ -0,0 +1 @@
Add __repr__ to EmptyStreamReader to avoid AttributeErrors.
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -160,6 +160,7 @@ Jake Davis
Jakob Ackermann
Jakub Wilk
Jan Buchar
Jarno Elonen
Jashandeep Sohi
Jean-Baptiste Estival
Jens Steinhauser
Expand Down
3 changes: 3 additions & 0 deletions aiohttp/streams.py
Expand Up @@ -492,6 +492,9 @@ class EmptyStreamReader(StreamReader): # lgtm [py/missing-call-to-init]
def __init__(self) -> None:
pass

def __repr__(self) -> str:
return "<%s>" % self.__class__.__name__

def exception(self) -> Optional[BaseException]:
return None

Expand Down
1 change: 1 addition & 0 deletions tests/test_streams.py
Expand Up @@ -1062,6 +1062,7 @@ async def test_unread_empty(self) -> None:

async def test_empty_stream_reader() -> None:
s = streams.EmptyStreamReader()
assert str(s) is not None
assert s.set_exception(ValueError()) is None
assert s.exception() is None
assert s.feed_eof() is None
Expand Down