In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you the example analysis of Fixture method-level operation in python. I hope you will get something after reading this article. Let's discuss it together.
Description
1. Define TestCase, that is, the method in the class where the test case is located.
2. DefsetUp is called automatically before the test case is executed.
3. DeftearDown is called automatically when the test case is executed.
If there are multiple test cases in TestCase, setUp and tearDown will be called automatically multiple times.
Example
The content of mytest.py is modified as follows:
Import unittest def my_sum (a, b): return a + b class my_test (unittest.TestCase): def setUp (self): print ("setup is automatically called") def tearDown (self): print ("teardown is automatically called") def test_001 (self): print (my_sum (5,6) def test_002 (self): print (my_sum (0) 3) after reading this article I believe you have a certain understanding of "sample analysis of Fixture method-level operations in python". If you want to know more about it, please follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.