zope.testrunner测试脚本
zope.testrunner 是 Zope testrunner 脚本。它通常用在项目中进行测试,比如:软件包目录内的测试,分装或模块命名测试。
代码示例:
import unittest import doctest class TestArithmetic(unittest.TestCase): def test_two_plus_two(self): self.assertEqual(2 + 2, 4) def doctest_string_formatting(): """Test Python string formatting >>> print('{} + {}'.format(2, 2)) 2 + 2 """ def test_suite(): return unittest.TestSuite([ unittest.makeSuite(TestArithmetic), doctest.DocTestSuite(), doctest.DocFileSuite('../README.txt', optionflags=doctest.ELLIPSIS), ])
评论