Skip to content

Commit 44745ca

Browse files
author
Felix Marczinowski
committed
fix tests for py3
1 parent 25fd0f8 commit 44745ca

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pandas/io/tests/json/test_json_norm.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import json
66

77
import pandas.util.testing as tm
8+
import pandas.compat
89

910
from pandas.io.json import json_normalize, nested_to_record
1011

@@ -166,13 +167,17 @@ def test_record_prefix(self):
166167
tm.assert_frame_equal(result, expected)
167168

168169
def test_non_ascii_key(self):
169-
testjson = '[{"\xc3\x9cnic\xc3\xb8de":0,"sub":{"A":1, "B":2}},' \
170-
'{"\xc3\x9cnic\xc3\xb8de":1,"sub":{"A":3, "B":4}}]'
170+
if pandas.compat.PY3:
171+
testjson = (b'[{"\xc3\x9cnic\xc3\xb8de":0,"sub":{"A":1, "B":2}},' + \
172+
b'{"\xc3\x9cnic\xc3\xb8de":1,"sub":{"A":3, "B":4}}]').decode('utf8')
173+
else:
174+
testjson = '[{"\xc3\x9cnic\xc3\xb8de":0,"sub":{"A":1, "B":2}},' \
175+
'{"\xc3\x9cnic\xc3\xb8de":1,"sub":{"A":3, "B":4}}]'
171176

172177
testdata = {
173178
u'sub.A': [1, 3],
174179
u'sub.B': [2, 4],
175-
"\xc3\x9cnic\xc3\xb8de".decode('utf8'): [0, 1]
180+
b"\xc3\x9cnic\xc3\xb8de".decode('utf8'): [0, 1]
176181
}
177182
testdf = DataFrame(testdata)
178183

0 commit comments

Comments
 (0)