parent
9f9e8db814
commit
43c4d23896
2 changed files with 19 additions and 0 deletions
|
@ -135,3 +135,9 @@ class JID(object):
|
|||
"""
|
||||
other = JID(other)
|
||||
return self.full == other.full
|
||||
|
||||
def __ne__(self, other):
|
||||
"""
|
||||
Two JIDs are considered unequal if they are not equal.
|
||||
"""
|
||||
return not self == other
|
||||
|
|
|
@ -124,5 +124,18 @@ class TestJIDClass(SleekTest):
|
|||
'component.someserver',
|
||||
'component.someserver')
|
||||
|
||||
def testJIDEquality(self):
|
||||
"""Test that JIDs with the same content are equal."""
|
||||
jid1 = JID('user@domain/resource')
|
||||
jid2 = JID('user@domain/resource')
|
||||
self.assertTrue(jid1 == jid2, "Same JIDs are not considered equal")
|
||||
self.assertFalse(jid1 != jid2, "Same JIDs are considered not equal")
|
||||
|
||||
def testJIDInequality(self):
|
||||
jid1 = JID('user@domain/resource')
|
||||
jid2 = JID('otheruser@domain/resource')
|
||||
self.assertFalse(jid1 == jid2, "Same JIDs are not considered equal")
|
||||
self.assertTrue(jid1 != jid2, "Same JIDs are considered not equal")
|
||||
|
||||
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(TestJIDClass)
|
||||
|
|
Loading…
Reference in a new issue