blob: a9a8f14c22023c4c1a7e87249daf6700b6efac71 [file] [log] [blame]
# Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
PYTHON_VERSION_COMPATIBILITY = "PY2+3"
DEPS = [
"file",
"path",
]
def RunSteps(api):
dest = api.path['start_dir'].join('some_file.json')
# Test a non-trivial number of keys in a dict. This tests that the keys
# are sorted in the output.
data = {str('key%d' % i): True for i in range(10)}
api.file.write_json('write_json', dest, data)
read_data = api.file.read_json('read_json', dest, test_data=data)
assert read_data == data, (read_data, data)
def GenTests(api):
yield api.test('basic')
yield (
api.test('failure')
+ api.step_data('read_json',
api.file.read_json(errno_name='JSON READ FAILURE'))
)