From: Yu Watanabe Date: Thu, 13 Oct 2022 08:41:45 +0000 (+0900) Subject: test: introduce __eq__() and __ne__() X-Git-Tag: v252-rc2~46^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F24985%2Fhead;p=thirdparty%2Fsystemd.git test: introduce __eq__() and __ne__() Suggested by CodeQL#160 (https://github.com/systemd/systemd/security/code-scanning/160). --- diff --git a/test/sd-script.py b/test/sd-script.py index 7662b12ab80..51ebf70c39e 100644 --- a/test/sd-script.py +++ b/test/sd-script.py @@ -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)