其他分享
首页 > 其他分享> > 对比json是否一样 (契约测试) 先记录用到再看看

对比json是否一样 (契约测试) 先记录用到再看看

作者:互联网

pip install verify_json

 

json_verify

说明: 主要用于json数据diff,输出匹配的字段信息、字段匹配准确率
gitlab: https://github.com/DaoSen-v/JsonDiff

from verify_json import JsonVerify

demo_json = {
    "msg": "一段文字信息",
    "phone": 13746067836,
    "name": [
        {"age": 12}, 
        {"phone": 213213, "age": 18}
    ]
}
check_json = {
    "msg": None,
    "address": "上海",
    "name": [
        {"age": 12, "language": "chinese"},
        {"phone": 213213, "age": 18},
    ]
}
instance = JsonVerify(demo_json)
instance.verify(check_json)
print(instance.info)
————————————————
版权声明:本文为CSDN博主「桦泽」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_33528044/article/details/119326041

 

标签:213213,phone,verify,age,instance,json,契约,用到
来源: https://www.cnblogs.com/kaibindirver/p/16659131.html