quality control one approach for developing high quality software is to write tests for each function as it is developed and to run those tests frequently during the development process the doctest module provides tool for scanning module and validating tests embedded in program' docstrings test construction is as simple as cutting-and-pasting typical call along with its results into the docstring this improves the documentation by providing the user with an example and it allows the doctest module to make sure the code remains true to the documentationdef average(values)"""computes the arithmetic mean of list of numbers print(average([ ]) ""return sum(valueslen(valuesimport doctest doctest testmod(automatically validate the embedded tests the unittest module is not as effortless as the doctest modulebut it allows more comprehensive set of tests to be maintained in separate fileimport unittest class teststatisticalfunctions(unittest testcase)def test_average(self)self assertequal(average([ ]) self assertequal(round(average([ ]) ) with self assertraises(zerodivisionerror)average([]with self assertraises(typeerror)average( unittest main(calling from the command line invokes all tests batteries included python has "batteries includedphilosophy this is best seen through the sophisticated and robust capabilities of its larger packages for examplethe xmlrpc client and xmlrpc server modules make implementing remote procedure calls into an almost trivial task despite the modules namesno direct knowledge or handling of xml is needed the email package is library for managing email messagesincluding mime and other rfc based message documents unlike smtplib and poplib which actually send and receive messagesthe email package has complete toolset for building or decoding complex message structures (including attachmentsand for implementing internet encoding and header protocols the json package provides robust support for parsing this popular data interchange format the csv module supports direct reading and writing of files in comma-separated value formatcommonly supported by databases and spreadsheets xml processing is supported by the xml etree elementtreexml dom and xml sax packages togetherthese modules and packages greatly simplify data interchange between python applications and other tools quality control