本文整理汇总了Python中unittest.TestCase.main方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.main方法的具体用法?Python TestCase.main怎么用?Python TestCase.main使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.TestCase
的用法示例。
在下文中一共展示了TestCase.main方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestText
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import main [as 别名]
from unittest import TestCase
from zmodulo.plot.text.text import Text
__author__ = 'aruff'
class TestText(TestCase):
""" Tester for the plot text Text
"""
def test_default_declaration_generation(self):
"""
Tests the generation of a font type declaration with
no parameters
"""
test = Text()
self.assertEqual(test.to_str(), '\ttext = "";\n')
def test_string_named_value_declaration_generation(self):
"""
Tests the generation of a font type declaration with
string parameters
"""
test = Text("Pooky")
self.assertEqual(test.to_str(), '\ttext = "Pooky";\n')
if __name__ == '__main__':
TestCase.main()
示例2: testImagrunittestTestCase
# 需要导入模块: from unittest import TestCase [as 别名]
# 或者: from unittest.TestCase import main [as 别名]
self.assertEqual(response.status_code, 302)
response = self.client.get('/imagr_app/follow/')
self.assertEqual(response.status_code, 302)
response = self.client.get('/imagr_app/history/')
self.assertEqual(response.status_code, 302)
response = self.client.get('/imagr_app/photo/1')
self.assertEqual(response.status_code, 301)
response = self.client.get('/imagr_app/photo/8/')
self.assertEqual(response.status_code, 302)
response = self.client.get('/imagr_app/delete_photo/1')
self.assertEqual(response.status_code, 301)
response = self.client.get('/imagr_app/delete_album/1')
self.assertEqual(response.status_code, 301)
# These test cases should be simple enough to require no Django
class testImagrunittestTestCase(unittestTestCase):
pass
if __name__ == '__main__':
setup_test_environment()
unittestTestCase.main()
teardown_test_environment()