we can have as many test methods on one testcase class as we likeas long as the method name begins with testthe test runner will execute each one as separate test each test should be completely independent of other tests results or calculations from previous test should have no impact on the current test the key to writing good unit tests is to keep each test method as short as possibletesting small unit of code with each test case if your code does not seem to naturally break up into such testable unitsit' probably sign that your design needs rethinking assertion methods the general layout of test case is to set certain variables to known valuesrun one or more functionsmethodsor processesand then "provethat correct expected results were returned or calculated by using testcase assertion methods there are few different assertion methods available to confirm that specific results have been achieved we just saw assertequalwhich will cause test failure if the two parameters do not pass an equality check the inverseassertnotequalwill fail if the two parameters do compare as equal the asserttrue and assertfalse methods each accept single expressionand fail if the expression does not pass an if test these tests are not checking for the boolean values true or false ratherthey test the same condition as though an if statement were usedfalsenone or an empty listdictionarystringsetor tuple would pass call to the assertfalse methodwhile nonzero numberscontainers with values in themor the value true would succeed when calling the asserttrue method there is an assertraises method that can be used to ensure specific function call raises specific exception oroptionallyit can be used as context manager to wrap inline code the test passes if the code inside the with statement raises the proper exceptionotherwiseit fails here' an example of both versionsimport unittest def average(seq)return sum(seqlen(seqclass testaverage(unittest testcase)def test_zero(self)self assertraises(zerodivisionerroraverage