(core) Remaining Python 3 compatibility changes

Summary: Biggest change is turning everything to unicode

Test Plan: The tests

Reviewers: dsagal, paulfitz

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2875
This commit is contained in:
Alex Hall
2021-06-24 14:23:33 +02:00
parent 1af99e9567
commit 305b133c59
30 changed files with 276 additions and 177 deletions

View File

@@ -59,7 +59,7 @@ def parse_testscript(script_path=None):
all_lines.append(line)
full_text = "".join(all_lines)
script = byteify(json.loads(full_text))
script = json.loads(full_text)
samples = {}
test_cases = []
@@ -109,16 +109,6 @@ def parse_test_sample(obj, samples={}):
return {"SCHEMA": schema, "DATA": data}
def byteify(data):
"""
Convert all unicode strings in a parsed JSON object into utf8-encoded strings. We deal with
utf8-encoded strings throughout the test.
"""
if isinstance(data, unicode):
return data.encode('utf-8')
return actions.convert_recursive_helper(byteify, data)
def replace_nans(data):
"""
Convert all NaNs and Infinities in the data to descriptive strings, since they cannot be