THRIFT-1857 Python 3 Support
Client: Python
Patch: Thomas Bartelmess, Eevee (Alex Munroe), helgridly, Christian Verkerk, Jeroen Vlek, Nobuaki Sukegawa
This closes #213 and closes #680
diff --git a/test/py/TSimpleJSONProtocolTest.py b/test/py/TSimpleJSONProtocolTest.py
index 080293a..b8db932 100644
--- a/test/py/TSimpleJSONProtocolTest.py
+++ b/test/py/TSimpleJSONProtocolTest.py
@@ -27,7 +27,7 @@
options, args = parser.parse_args()
del sys.argv[1:] # clean up hack so unittest doesn't complain
sys.path.insert(0, options.genpydir)
-sys.path.insert(0, glob.glob('../../lib/py/build/lib.*')[0])
+sys.path.insert(0, glob.glob('../../lib/py/build/lib*')[0])
from ThriftTest.ttypes import *
from thrift.protocol import TJSONProtocol
@@ -45,7 +45,7 @@
# assertDictEqual only in Python 2.7. Depends on your machine.
self.assertDictEqual(a, b, msg)
return
-
+
# Substitute implementation not as good as unittest library's
self.assertEquals(len(a), len(b), msg)
for k, v in a.iteritems():
@@ -66,7 +66,7 @@
def testWriteOnly(self):
self.assertRaises(NotImplementedError,
- self._deserialize, VersioningTestV1, '{}')
+ self._deserialize, VersioningTestV1, b'{}')
def testSimpleMessage(self):
v1obj = VersioningTestV1(
@@ -76,10 +76,10 @@
expected = dict(begin_in_both=v1obj.begin_in_both,
old_string=v1obj.old_string,
end_in_both=v1obj.end_in_both)
- actual = json.loads(self._serialize(v1obj))
+ actual = json.loads(self._serialize(v1obj).decode('ascii'))
self._assertDictEqual(expected, actual)
-
+
def testComplicated(self):
v2obj = VersioningTestV2(
begin_in_both=12345,
@@ -107,10 +107,10 @@
newmap=v2obj.newmap,
newstring=v2obj.newstring,
end_in_both=v2obj.end_in_both)
-
+
# Need to load/dump because map keys get escaped.
expected = json.loads(json.dumps(expected))
- actual = json.loads(self._serialize(v2obj))
+ actual = json.loads(self._serialize(v2obj).decode('ascii'))
self._assertDictEqual(expected, actual)