Stupid __eq__ not being used in __ne__...

This commit is contained in:
Jeremy Fincher 2003-10-09 05:46:35 +00:00
parent ce0002f454
commit 8eed3f0982
2 changed files with 10 additions and 1 deletions

View File

@ -326,6 +326,9 @@ class IrcString(str):
except:
return False
def __ne__(self, s):
return not self == s
def __hash__(self):
return hash(self.lowered)

View File

@ -212,7 +212,7 @@ class IrcSetTestCase(unittest.TestCase):
self.failIf('FOo' in s)
class IrcStringTestCase(unittest.TestCase):
def test(self):
def testEquality(self):
self.assertEqual('#foo', ircutils.IrcString('#foo'))
self.assertEqual('#foo', ircutils.IrcString('#FOO'))
self.assertEqual('#FOO', ircutils.IrcString('#foo'))
@ -220,6 +220,12 @@ class IrcStringTestCase(unittest.TestCase):
self.assertEqual(hash(ircutils.IrcString('#FOO')),
hash(ircutils.IrcString('#foo')))
def testInequality(self):
s1 = 'supybot'
s2 = ircutils.IrcString('Supybot')
self.failUnless(s1 == s2)
self.failIf(s1 != s2)
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: