From: Bob Halley Date: Sun, 31 Jan 2021 22:50:14 +0000 (-0800) Subject: Abstract methods should raise NotImplementedError, not return None X-Git-Tag: v2.2.0rc1~111 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5f45d6037aa3c9064eb880cf9c22d5180e4cf160;p=thirdparty%2Fdnspython.git Abstract methods should raise NotImplementedError, not return None getpeername() and getsockname() are part of the abstract API but weren't defined. --- diff --git a/dns/_asyncbackend.py b/dns/_asyncbackend.py index c7ecfada..0ce316b2 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