zope.testrunner測(cè)試腳本
zope.testrunner 是 Zope testrunner 腳本。它通常用在項(xiàng)目中進(jìn)行測(cè)試,比如:軟件包目錄內(nèi)的測(cè)試,分裝或模塊命名測(cè)試。
代碼示例:
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),
])
評(píng)論
圖片
表情
