如何在Python单元测试中访问全局变量?

时间:2016-04-13 16:35:24

标签: python unit-testing global-variables

我有一个名为backend的模块,它有一个population.py Python文件。 population.get_distinct_persons()将不同的人ID存储到全局集中:

man/*.Md

我需要为函数get_distinct_persons编写一个单元测试,检查预期和实际的distinct_persons是否相等。我看过这篇文章Offer type,并且知道Python模拟模块可能让我这样做,但还没有找到一种有效的方法。请分享您的想法和想法。谢谢!

0 个答案:

没有答案