From 74522aa87fc31f448248c8a37afc73a8fd9d6f65 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 13 Oct 2022 17:41:45 +0900 Subject: [PATCH] test: introduce __eq__() and __ne__() Suggested by CodeQL#160 (https://github.com/systemd/systemd/security/code-scanning/160). --- test/sd-script.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/sd-script.py b/test/sd-script.py index 7662b12ab8..51ebf70c39 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)