What class will you inherit from if you create a test case (framework unittest)?

Questions & AnswersCategory: PythonWhat class will you inherit from if you create a test case (framework unittest)?
Lokesh Kumar Staff asked 2 years ago

What class will you inherit from if you create a test case (framework unittest)?
a. unittest.TestCase
b. unittest.UnitTest
c. unitest.TestLoader
d. unittest.TestSuite
e. unittest.TestRunner

1 Answers
Lokesh Kumar Staff answered 2 years ago

a. unittest.TestCase
 
Explanation:
The basic building blocks of unit testing are test cases — single scenarios that must be set up and checked for correctness. In unittest, test cases are represented by unittest.TestCase instances. To make your own test cases you must write subclasses of TestCase or use FunctionTestCase.