1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-21 13:34:21 +03:00

test: introduce __eq__() and __ne__()

Suggested by CodeQL#160 (https://github.com/systemd/systemd/security/code-scanning/160).
This commit is contained in:
Yu Watanabe 2022-10-13 17:41:45 +09:00
parent f9d1709c03
commit 74522aa87f

View File

@ -100,6 +100,12 @@ class SD(object):
def __cmp__(self, other):
return cmp(self._num, other._num)
def __eq__(self, other):
return self.__cmp__(other) == 0
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash(self._num)