【发布时间】:2016-03-21 19:08:25
【问题描述】:
我正在尝试导入一个类,而不是通过传入值 'stage'、'prod' 来测试该类中的方法 (production_warning) 以查看它是否返回预期结果。
import runner
test=runnerData(force_redeploy=False, pfactor=None, preview=True)
def production_warning_test():
assert.test.production_warning('stage') not errors
assert.test.production_warning('prod') contains "warning"
#run unit test
productionwarningtest()
我显然在这里完全错误地使用了断言,我该如何正确地完成我想要用断言做的事情。
【问题讨论】:
-
Python中没有“受保护的类方法”之类的东西。
标签: python unit-testing assert