25. 开发工具
************

本章中描述的各模块可帮你编写 Python 程序。例如，"pydoc" 模块接受一个模
块并根据该模块的内容来生成文档。"doctest" 和 "unittest" 这两个模块包含
了用于编写单元测试的框架，并可用于自动测试所编写的代码，验证预期的输出
是否产生。**2to3** 程序能够将 Python 2.x 源代码翻译成有效的 Python 3.x
源代码。

本章中描述的模块列表是：

* 25.1. "pydoc" — Documentation generator and online help system

* 25.2. "doctest" — Test interactive Python examples

  * 25.2.1. Simple Usage: Checking Examples in Docstrings

  * 25.2.2. Simple Usage: Checking Examples in a Text File

  * 25.2.3. How It Works

    * 25.2.3.1. Which Docstrings Are Examined?

    * 25.2.3.2. How are Docstring Examples Recognized?

    * 25.2.3.3. What’s the Execution Context?

    * 25.2.3.4. What About Exceptions?

    * 25.2.3.5. Option Flags

    * 25.2.3.6. Directives

    * 25.2.3.7. Warnings

  * 25.2.4. Basic API

  * 25.2.5. Unittest API

  * 25.2.6. Advanced API

    * 25.2.6.1. DocTest Objects

    * 25.2.6.2. Example Objects

    * 25.2.6.3. DocTestFinder objects

    * 25.2.6.4. DocTestParser objects

    * 25.2.6.5. DocTestRunner objects

    * 25.2.6.6. OutputChecker objects

  * 25.2.7. Debugging

  * 25.2.8. Soapbox

* 25.3. "unittest" — 单元测试框架

  * 25.3.1. Basic example

  * 25.3.2. Command-Line Interface

    * 25.3.2.1. Command-line options

  * 25.3.3. Test Discovery

  * 25.3.4. Organizing test code

  * 25.3.5. Re-using old test code

  * 25.3.6. Skipping tests and expected failures

  * 25.3.7. Classes and functions

    * 25.3.7.1. Test cases

      * 25.3.7.1.1. Deprecated aliases

    * 25.3.7.2. Grouping tests

    * 25.3.7.3. Loading and running tests

      * 25.3.7.3.1. load_tests Protocol

  * 25.3.8. Class and Module Fixtures

    * 25.3.8.1. setUpClass and tearDownClass

    * 25.3.8.2. setUpModule and tearDownModule

  * 25.3.9. Signal Handling

* 25.4. 2to3 - 自动将 Python 2 代码转为 Python 3 代码

  * 25.4.1. 使用 2to3

  * 25.4.2. 修复器

  * 25.4.3. "lib2to3" —— 2to3 支持库

* 25.5. "test" — Regression tests package for Python

  * 25.5.1. Writing Unit Tests for the "test" package

  * 25.5.2. Running tests using the command-line interface

* 25.6. "test.support" — Utility functions for tests
