解析json数据,提示ValueError错误
liuchangfu opened this issue · comments
在解析json数据的时候,运行github上面的demo时,报错了ValueError: Check the test data, no 'name'
Traceback (most recent call last):
File "D:\Python310\lib\site-packages\seldom\testdata\conversion.py", line 111, in json_to_list
data = json.load(f)[key]
KeyError: 'name'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\workspace\seldom-web-testing\test_dir\test_006_file_ddt.py", line 5, in
class FileDataTest(seldom.TestCase):
File "E:\workspace\seldom-web-testing\test_dir\test_006_file_ddt.py", line 13, in FileDataTest
@file_data("json_data.json", key="name")
File "D:\Python310\lib\site-packages\seldom\testdata\parameterization.py", line 158, in file_data
data_list = conversion.json_to_list(file_path, key=key)
File "D:\Python310\lib\site-packages\seldom\testdata\conversion.py", line 114, in json_to_list
raise ValueError("Check the test data, no '{}'".format(key))
ValueError: Check the test data, no 'name'