如何测试两个字典是否与python中的pytest相等 [英] How can you test that two dictionaries are equal with pytest in python
本文介绍了如何测试两个字典是否与python中的pytest相等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
推荐答案
不要花时间自己编写此逻辑。只需使用默认测试库unittest
from unittest import TestCase
TestCase().assertDictEqual(expected_dict, actual_dict)
这篇关于如何测试两个字典是否与python中的pytest相等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文