From 3f9c699ea22f173eba6d60729b73d52b08c28b8e Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 3 Dec 2004 08:08:07 +0000 Subject: [PATCH] Fix for bug in IrcMsg.__eq__. --- src/ircmsgs.py | 3 ++- test/test_ircmsgs.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ircmsgs.py b/src/ircmsgs.py index 14ddc188a..7a8e976c0 100644 --- a/src/ircmsgs.py +++ b/src/ircmsgs.py @@ -179,7 +179,8 @@ class IrcMsg(object): return self._len def __eq__(self, other): - return hash(self) == hash(other) and \ + return isinstance(other, self.__class__) and \ + hash(self) == hash(other) and \ self.command == other.command and \ self.prefix == other.prefix and \ self.args == other.args diff --git a/test/test_ircmsgs.py b/test/test_ircmsgs.py index a37a748fe..5a05bcd4f 100644 --- a/test/test_ircmsgs.py +++ b/test/test_ircmsgs.py @@ -59,6 +59,7 @@ class IrcMsgTestCase(SupyTestCase): def testEq(self): for msg in msgs: self.assertEqual(msg, msg) + self.failIf(msgs[0] == []) # Comparison to unhashable type. def testNe(self): for msg in msgs: