mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +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):
|
def __hash__(self):
|
||||||
if self._hash is not None:
|
if self._hash is not None:
|
||||||
return self._hash
|
return self._hash
|
||||||
self._hash = hash(self.command) & \
|
self._hash = hash(self.command) ^ \
|
||||||
hash(self.prefix) & \
|
hash(self.prefix) ^ \
|
||||||
hash(self.args)
|
hash(self.args)
|
||||||
return self._hash
|
return self._hash
|
||||||
|
|
||||||
|
@ -97,6 +97,13 @@ class IrcMsgTestCase(unittest.TestCase):
|
|||||||
self.assertEqual(msg, pickle.loads(pickle.dumps(msg)))
|
self.assertEqual(msg, pickle.loads(pickle.dumps(msg)))
|
||||||
self.assertEqual(msg, copy.copy(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):
|
class FunctionsTestCase(unittest.TestCase):
|
||||||
def testIsAction(self):
|
def testIsAction(self):
|
||||||
L = [':jemfinch!~jfincher@ts26-2.homenet.ohio-state.edu PRIVMSG'
|
L = [':jemfinch!~jfincher@ts26-2.homenet.ohio-state.edu PRIVMSG'
|
||||||
|
Loading…
Reference in New Issue
Block a user