mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user