debuggingtestingand profiling suite unittest testsuite(suite addtest(doctest doctestsuite(blocks)runner unittest texttestrunner(print(runner run(suite)note that there is an implicit restriction on the names of our programs if we take this approachthey must have names that are valid module namesso program called convert-incidents py cannot have test like this written for it because import convert-incidents is not valid since hyphens are not legal in python identifiers (it is possible to get around thisbut the easiest solution is to use program filenames that are also valid module namesfor examplereplacing hyphens with underscores the structure shown here--create test suiteadd one or more test cases or test suitesrun the overarching test suiteand output the results--is typical of unittest-based tests when runthis particular example produces the following outputran tests in ok each time test case is executed period is output (hence the three periods at the beginning of the output)then line of hyphensand then the test summary (naturallythere is lot more output if any tests fail if we are making the effort to have separate tests (typically one for each program and module we want to test)then rather than using doctests we might prefer to directly use the unittest module' features--especially if we are used to the junit approach to testing the unittest module keeps our tests separate from our code--this is particularly useful for larger projects where test writers and developers are not necessarily the same people alsounittest unit tests are written as stand-alone python modulesso they are not limited by what we can comfortably and sensibly write inside docstring the unittest module defines four key concepts test fixture is the term used to describe the code necessary to set up test (and to tear it downthat isclean upafterwardtypical examples are creating an input file for the test to use and at the end deleting the input file and the resultant output file test suite is collection of test cases and test case is the basic unit of testing--test suites are collections of test cases or of other test suites--we'll see practical examples of these shortly test runner is an object that executes one or more test suites