summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/test/sleektest.py7
-rw-r--r--sleekxmpp/xmlstream/jid.py11
2 files changed, 12 insertions, 6 deletions
diff --git a/sleekxmpp/test/sleektest.py b/sleekxmpp/test/sleektest.py
index fd47a87e..24af1e7a 100644
--- a/sleekxmpp/test/sleektest.py
+++ b/sleekxmpp/test/sleektest.py
@@ -16,7 +16,8 @@ import sleekxmpp
from sleekxmpp import ClientXMPP, ComponentXMPP
from sleekxmpp.stanza import Message, Iq, Presence
from sleekxmpp.test import TestSocket, TestLiveSocket
-from sleekxmpp.xmlstream import StanzaBase, ET, register_stanza_plugin
+from sleekxmpp.xmlstream import ET, register_stanza_plugin
+from sleekxmpp.xmlstream import ElementBase, StanzaBase
from sleekxmpp.xmlstream.tostring import tostring
from sleekxmpp.xmlstream.matcher import StanzaPath, MatcherId
from sleekxmpp.xmlstream.matcher import MatchXMLMask, MatchXPath
@@ -201,7 +202,7 @@ class SleekTest(unittest.TestCase):
"Stanza:\n%s" % str(stanza))
else:
stanza_class = stanza.__class__
- if isinstance(criteria, str):
+ if not isinstance(criteria, ElementBase):
xml = self.parse_xml(criteria)
else:
xml = criteria.xml
@@ -606,7 +607,7 @@ class SleekTest(unittest.TestCase):
self.fail("Stanza data was sent: %s" % sent)
if sent is None:
self.fail("No stanza was sent.")
-
+
xml = self.parse_xml(sent)
self.fix_namespaces(xml, 'jabber:client')
sent = self.xmpp._build_stanza(xml, 'jabber:client')
diff --git a/sleekxmpp/xmlstream/jid.py b/sleekxmpp/xmlstream/jid.py
index 5019a25e..36b33056 100644
--- a/sleekxmpp/xmlstream/jid.py
+++ b/sleekxmpp/xmlstream/jid.py
@@ -6,6 +6,8 @@
See the file LICENSE for copying permission.
"""
+from __future__ import unicode_literals
+
class JID(object):
"""
@@ -42,7 +44,9 @@ class JID(object):
Arguments:
jid - The new JID value.
"""
- self._full = self._jid = str(jid)
+ if isinstance(jid, JID):
+ jid = jid.full
+ self._full = self._jid = jid
self._domain = None
self._resource = None
self._user = None
@@ -123,10 +127,11 @@ class JID(object):
return self.full
def __repr__(self):
- return str(self)
+ return self.full
def __eq__(self, other):
"""
Two JIDs are considered equal if they have the same full JID value.
"""
- return str(other) == str(self)
+ other = JID(other)
+ return self.full == other.full