Return NotImplemented sooner for ErrorDetail equality test

The test suite raises warnings when tested against Python 3.9
`DeprecationWarning: NotImplemented should not be used in a boolean context`

Where `r` returns `NotImplemented` then this change returns `NotImplemented` first to avoid the comparison test.
This commit is contained in:
David Smith 2020-09-09 22:01:26 +01:00
parent 04f39c42ee
commit 52e12d9ef6

View File

@ -73,6 +73,8 @@ class ErrorDetail(str):
def __eq__(self, other):
r = super().__eq__(other)
if r is NotImplemented:
return NotImplemented
try:
return r and self.code == other.code
except AttributeError: