]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: introduce __eq__() and __ne__() 24985/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Oct 2022 08:41:45 +0000 (17:41 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Oct 2022 08:41:48 +0000 (17:41 +0900)
Suggested by CodeQL#160 (https://github.com/systemd/systemd/security/code-scanning/160).

test/sd-script.py

index 7662b12ab802a2dc4482ef9da97a0f322b97e156..51ebf70c39ecab231f55d66ebfb902418fe070c1 100644 (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)