]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Abstract methods should raise NotImplementedError, not return None
authorBob Halley <halley@dnspython.org>
Sun, 31 Jan 2021 22:50:14 +0000 (14:50 -0800)
committerBob Halley <halley@dnspython.org>
Sun, 31 Jan 2021 22:50:14 +0000 (14:50 -0800)
getpeername() and getsockname() are part of the abstract API but weren't
defined.

dns/_asyncbackend.py

index c7ecfada96614b213233ed42548d96e8ac1103c4..0ce316b231d258821ef88e8cda903cbb92a45882 100644 (file)
@@ -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