我的代码怎么没有执行类方法
来源:5-1 unittest简单使用

thinkwinter
2018-03-11
import unittest
class Test_Unit(unittest.TestCase):
@classmethod
def setUpClass(cls):
print('类执行之前执行')
@classmethod
def tearDownClass(cls):
print('类执行之后执行')
def setUp(self):
print('setUP方法执行之前执行')
def tearDown(self):
print('tearDown方法执行之后执行')
def test_01(self):
print('执行方法1')
def test_02(self):
print('执行方法2')
if __name__ == '__mail__':
unittest.main()
输出:
Ran 2 tests in 0.002s
OK
setUP方法执行之前执行
执行方法1
tearDown方法执行之后执行
setUP方法执行之前执行
执行方法2
tearDown方法执行之后执行
Process finished with exit code 0
写回答
1回答
-
Mushishi
2018-03-12
你好,你这个代码没问题,你还不行么?你在群里发一下,然后你python是多少的?
062018-03-13
相似问题