薰樱子,双子妹与单亲妈的恋爱攻略,起底保利俱乐部
本文实例讲述了python测试驱动开发的方法,分享给大家供大家参考。具体方法如下:
import unittest from main import sample class sampletest(unittest.testcase): def setup(self): print "create a new sample" self._sample = sample("b64e5843ca7db8199c405be565fa7f57") def teardown(self): print "destory the sample" self._sample = none def test_getvirusnamefromvt(self): "this md5 has the vt info" asample = sample("b64e5843ca7db8199c405be565fa7f57") dict_virusname = asample._getvirusnamefromvt() self.asserttrue(dict_virusname!=none) def test_getvirusnamefromvt2(self): "this md5 has not the vt info" asample = sample("2b666ffe98e465523e514d2b93b7666a") dict_virusname = asample._getvirusnamefromvt () self.asserttrue(len(dict_virusname) == 0) if __name__=="__main__": #unittest.main() suite = unittest.testloader().loadtestsfromtestcase(sampletest) unittest.texttestrunner(verbosity=2).run(suite)
希望本文所述对大家的python程序设计有所帮助。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python爬虫:Request Payload和Form Data的简单区别说明
浅谈Python中threading join和setDaemon用法及区别说明
Python3-异步进程回调函数(callback())介绍
python继承threading.Thread实现有返回值的子类实例
Python中使用threading.Event协调线程的运行详解
网友评论