tools the firstpyunit (called unittest in the library manual)provides an objectoriented class framework for specifying and customizing test cases and expected results it mimics the junit framework for java this is sophisticated class-based unit testing systemsee the python library manual for details doctest the doctest standard library module provides second and simpler approach to regression testingbased upon python' docstrings feature roughlyto use doct estyou cut and paste log of an interactive testing session into the docstrings of your source files doctest then extracts your docstringsparses out the test cases and resultsand reruns the tests to verify the expected results doctest' operation can be tailored in variety of wayssee the library manual for more details ides we discussed ides for python in ides such as idle provide graphical environment for editingrunningdebuggingand browsing your python programs some advanced ides--such as eclipsekomodonetbeansand others listed in --may support additional development tasksincluding source control integrationcode refactoringproject management toolsand more see the text editors page at search engine for more on available ides and gui builders for python profilers because python is so high-level and dynamicintuitions about performance gleaned from experience with other languages usually don' apply to python code to truly isolate performance bottlenecks in your codeyou need to add timing logic with clock tools in the time or timeit modulesor run your code under the pro file module we saw an example of the timing modules at work when comparing the speed of iteration tools and pythons in profiling is usually your first optimization step--code for claritythen profile to isolate bottlenecksand then time alternative codings of the slow parts of your program for the second of these stepsprofile is standard library module that implements source code profiler for python it runs string of code you provide ( script file importor call to functionand thenby defaultprints report to the standard output stream that gives performance statistics--number of calls to each functiontime spent in each functionand more the profile module can be run as script or importedand it may be customized in various waysfor exampleit can save run statistics to file to be analyzed later with the pstats module to profile interactivelyimport the profile module and call profile run('code')passing in the code you wish to profile as string ( call to functionan import of fileor code read from fileto profile from system shell command lineuse command of the form python - profile main py args (see appendix for more on this formatalso see python' standard library manuals for other profiling optionsthe cprofile modulefor examplehas designing with exceptions