mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
Most IrcMsg.__hash__ were returning 0, because I was using & instead of ^
This commit is contained in:
parent
cec0f77538
commit
071f3916f8
@ -168,8 +168,8 @@ class IrcMsg(object):
|
||||
def __hash__(self):
|
||||
if self._hash is not None:
|
||||
return self._hash
|
||||
self._hash = hash(self.command) & \
|
||||
hash(self.prefix) & \
|
||||
self._hash = hash(self.command) ^ \
|
||||
hash(self.prefix) ^ \
|
||||
hash(self.args)
|
||||
return self._hash
|
||||
|
||||
|
@ -97,6 +97,13 @@ class IrcMsgTestCase(unittest.TestCase):
|
||||
self.assertEqual(msg, pickle.loads(pickle.dumps(msg)))
|
||||
self.assertEqual(msg, copy.copy(msg))
|
||||
|
||||
def testHashNotZero(self):
|
||||
zeroes = 0
|
||||
for msg in msgs:
|
||||
if hash(msg) == 0:
|
||||
zeroes += 1
|
||||
self.failIf(zeroes > (len(msgs)/10), 'Too many zero hashes.')
|
||||
|
||||
class FunctionsTestCase(unittest.TestCase):
|
||||
def testIsAction(self):
|
||||
L = [':jemfinch!~jfincher@ts26-2.homenet.ohio-state.edu PRIVMSG'
|
||||
|
Loading…
Reference in New Issue
Block a user