From a799ce3df117e31be5eee61d4422a07e681e9a4c Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Wed, 11 Sep 2013 19:50:33 +0000 Subject: [PATCH] Make hint comparison more intelligent "easy foo/1 bar/2" and "easy bar/2 foo/1" are simply different ways of writing the same hint, so the corresponding Hint objects should compare as equal. Signed-off-by: Adam D. Barratt --- hints.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hints.py b/hints.py index 6586e48..b54584c 100644 --- a/hints.py +++ b/hints.py @@ -77,7 +77,12 @@ class Hint(object): return self._hint def __eq__(self, other): - return str(self) == str(other) + if self.type != other.type: + return False + elif self.type == 'age-days' and self.days != other.days: + return False + else: + return frozenset(self.packages) == frozenset(other.packages) @property def type(self):