unittest
-
You can download this unittest in the source files that come with the article .
您可以在本文所附带的源文件中下载这个单元测试。
-
One final feature to demonstrate is running a unittest within an IPython shell .
这里要展示的最后一个特性是,在IPythonShell中运行单元测试。
-
It is quite handy to frequently run a unittest when making changes to a module .
在对模块进行更改时,需要频繁地运行单元测试,而这也是非常容易的。
-
Done this way , the unittest module will accept a-v option for more verbose output .
使用这种方式时,unittest模块将接受一个-v选项以给出更详细的输出。
-
The unittest framework will cycle through the test functions , calling setUp , the test function , then tearDown for each test function .
unittest框架会在测试函数之间循环往复,先调用setUp、再测试函数、然后清除(tearDown)测试函数。
-
Also note , finally , that the Zope test frameworks only support tests that are either UnitTest instances or doctests .
最后注意,Zope测试框架只支持UnitTest实例或doctest。
-
It will , however , use its own regular expression to determine which of their methods are tests , rather than using the standard unittest pattern of ^ test .
但是,它会根据自己的正则表达式决定哪些方法是测试,而不使用标准的unittest模式^test。
-
If you write all of your tests from the ground up using only the clunky standard Python unittest module , then they will work under any testing framework you choose .
如果只使用笨拙的标准Pythonunittest模块从头编写所有测试,那么它们能够在任何测试框架中运行。
-
If any assertion does not evaluate to true , or if any exceptions are thrown as a part of processing , unittest will report it as a test failure or error .
如果任何assert的求值结果不是真,或是在执行过程中抛出任何异常,unittest就会报告一次测试失败或错误。
-
You need to add a flag to run run-e so that you can avoid getting a traceback to the unittest module in the IPython shell .
您需要添加一个标记以运行run-e,这样一来,您就可以在IPythonShell中避免回溯到单元测试模块。