summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-03-19 14:24:45 -0700
committerLance Stout <lancestout@gmail.com>2012-03-19 14:24:45 -0700
commit859822ff05c0c19cc16965918ef1d76eb8e531cb (patch)
tree0daa391638fbb2ddaf2d0ea439fa3c44f3172b66
parent3acc7d0914eb1ad883caf6a39685a807a17ba75c (diff)
downloadslixmpp-859822ff05c0c19cc16965918ef1d76eb8e531cb.tar.gz
slixmpp-859822ff05c0c19cc16965918ef1d76eb8e531cb.tar.bz2
slixmpp-859822ff05c0c19cc16965918ef1d76eb8e531cb.tar.xz
slixmpp-859822ff05c0c19cc16965918ef1d76eb8e531cb.zip
Fix unicode issues in test cases for Py3+ introduced by issue #150.
-rw-r--r--sleekxmpp/plugins/xep_0009/binding.py6
-rw-r--r--tests/test_stanza_xep_0009.py8
2 files changed, 12 insertions, 2 deletions
diff --git a/sleekxmpp/plugins/xep_0009/binding.py b/sleekxmpp/plugins/xep_0009/binding.py
index 5418626b..a55993ad 100644
--- a/sleekxmpp/plugins/xep_0009/binding.py
+++ b/sleekxmpp/plugins/xep_0009/binding.py
@@ -10,6 +10,10 @@ from sleekxmpp.xmlstream import ET
import base64
import logging
import time
+import sys
+
+if sys.version_info > (3, 0):
+ unicode = str
log = logging.getLogger(__name__)
@@ -152,7 +156,7 @@ class rpctime(object):
def __init__(self,data=None):
#assume string data is in iso format YYYYMMDDTHH:MM:SS
- if type(data) is str:
+ if type(data) in (str, unicode):
self.timestamp = time.strptime(data,"%Y%m%dT%H:%M:%S")
elif type(data) is time.struct_time:
self.timestamp = data
diff --git a/tests/test_stanza_xep_0009.py b/tests/test_stanza_xep_0009.py
index 724ebb95..fa1ed19b 100644
--- a/tests/test_stanza_xep_0009.py
+++ b/tests/test_stanza_xep_0009.py
@@ -8,7 +8,10 @@
See the file LICENSE for copying permission.
"""
+from __future__ import unicode_literals
+
import base64
+import sys
from sleekxmpp.plugins.xep_0009.stanza.RPC import RPCQuery, MethodCall, \
MethodResponse
@@ -21,6 +24,9 @@ from sleekxmpp.xmlstream.tostring import tostring
import unittest
+if sys.version_info > (3, 0):
+ unicode = str
+
class TestJabberRPC(SleekTest):
@@ -117,7 +123,7 @@ class TestJabberRPC(SleekTest):
"XML to string conversion")
def testConvertUnicodeString(self):
- params = [u"おはよう"]
+ params = ["おはよう"]
params_xml = py2xml(*params)
expected_xml = self.parse_xml("""
<params xmlns="jabber:iq:rpc">