本文整理匯總了Python中tornado.test.util.unittest.TestCase方法的典型用法代碼示例。如果您正苦於以下問題:Python unittest.TestCase方法的具體用法?Python unittest.TestCase怎麽用?Python unittest.TestCase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tornado.test.util.unittest
的用法示例。
在下文中一共展示了unittest.TestCase方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_set_up_tear_down
# 需要導入模塊: from tornado.test.util import unittest [as 別名]
# 或者: from tornado.test.util.unittest import TestCase [as 別名]
def test_set_up_tear_down(self):
"""
This test makes sure that AsyncTestCase calls super methods for
setUp and tearDown.
InheritBoth is a subclass of both AsyncTestCase and
SetUpTearDown, with the ordering so that the super of
AsyncTestCase will be SetUpTearDown.
"""
events = []
result = unittest.TestResult()
class SetUpTearDown(unittest.TestCase):
def setUp(self):
events.append('setUp')
def tearDown(self):
events.append('tearDown')
class InheritBoth(AsyncTestCase, SetUpTearDown):
def test(self):
events.append('test')
InheritBoth('test').run(result)
expected = ['setUp', 'test', 'tearDown']
self.assertEqual(expected, events)