There are three levels of setup and teardown available for the
unittest modules. Here are the three different kinds of testing scopes: method, class, and module.
TestCaseclass has had a proper setup and teardown. Often, we'll use the
setUp()method to create the unit objects and any mock objects that are required. We don't want to do something costly such as creating whole databases, as these methods are used before and after each test method.
TestCaseclass. These methods bracket the sequence ...