summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2021-01-31 14:50:14 -0800
committerBob Halley <halley@dnspython.org>2021-01-31 14:50:14 -0800
commit5f45d6037aa3c9064eb880cf9c22d5180e4cf160 (patch)
treeeafde9d0d0c9845d92c9537ad0aa318815d5c36f
parent3ee950f8c8b31f0f12d896f1ea335f99d53def94 (diff)
downloaddnspython-5f45d6037aa3c9064eb880cf9c22d5180e4cf160.tar.gz
Abstract methods should raise NotImplementedError, not return None
getpeername() and getsockname() are part of the abstract API but weren't defined.
-rw-r--r--dns/_asyncbackend.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/dns/_asyncbackend.py b/dns/_asyncbackend.py
index c7ecfad..0ce316b 100644
--- a/dns/_asyncbackend.py
+++ b/dns/_asyncbackend.py
@@ -27,6 +27,12 @@ class Socket: # pragma: no cover
async def close(self):
pass
+ async def getpeername(self):
+ raise NotImplementedError
+
+ async def getsockname(self):
+ raise NotImplementedError
+
async def __aenter__(self):
return self
@@ -36,18 +42,18 @@ class Socket: # pragma: no cover
class DatagramSocket(Socket): # pragma: no cover
async def sendto(self, what, destination, timeout):
- pass
+ raise NotImplementedError
async def recvfrom(self, size, timeout):
- pass
+ raise NotImplementedError
class StreamSocket(Socket): # pragma: no cover
async def sendall(self, what, destination, timeout):
- pass
+ raise NotImplementedError
async def recv(self, size, timeout):
- pass
+ raise NotImplementedError
class Backend: # pragma: no cover