上一话题

IDLE

下一话题
就业培训     下载中心     Wiki     联络
登录   注册

Log
  1. 首页
  2. Python 3.12.4
  3. 索引
  4. 模块
  5. 下一
  6. 上一
  7. Python 标准库
  8. 开发工具

开发工具 ¶

此章描述的模块帮助您编写软件。例如, pydoc module takes a module and generates documentation based on the module’s contents. The doctest and unittest modules contains frameworks for writing unit tests that automatically exercise code and verify that the expected output is produced. 2to3 can translate Python 2.x source code into valid Python 3.x code.

此章描述的模块列表:

  • typing — 支持类型提示
    • Specification for the Python Type System
    • 类型别名
    • NewType
    • Annotating callable objects
    • 一般
    • Annotating tuples
    • The type of class objects
    • 用户定义一般类型
    • The Any type
    • 名义 vs 结构子类型
    • 模块内容
      • 特殊 typing 原语
        • 特殊类型
        • 特殊形式
        • Building generic types and type aliases
        • 其它特殊指令
      • 协议
      • ABCs for working with IO
      • 函数和装饰器
      • 自省帮手
      • 常量
      • Deprecated aliases
        • Aliases to built-in types
        • Aliases to types in collections
        • Aliases to other concrete types
        • Aliases to container ABCs in collections.abc
        • Aliases to asynchronous ABCs in collections.abc
        • Aliases to other ABCs in collections.abc
        • Aliases to contextlib ABCs
    • 主要特征弃用时间线
  • pydoc — 文档编制生成器和在线帮助系统
  • Python 开发模式
    • Python 开发模式的影响
    • ResourceWarning 范例
    • 坏的文件描述符错误范例
  • doctest — 测试交互 Python 范例
    • 简单用法:校验 docstring (文档字符串) 中的范例
    • 简单用法:校验文本文件中的范例
    • 它如何工作
      • Which Docstrings Are Examined?
      • How are Docstring Examples Recognized?
      • What’s the Execution Context?
      • What About Exceptions?
      • 选项标志
      • 指令
      • 警告
    • 基本 API
    • Unittest API
    • 高级 API
      • DocTest 对象
      • 范例对象
      • DocTestFinder 对象
      • DocTestParser 对象
      • DocTestRunner 对象
      • OutputChecker 对象
    • 调试
    • Soapbox
  • unittest — 单元测试框架
    • 基本范例
    • 命令行接口
      • 命令行选项
    • 测试探索
    • 组织测试代码
    • 重用旧测试代码
    • Skipping tests and expected failures
    • Distinguishing test iterations using subtests
    • 类和函数
      • Test cases
      • Grouping tests
      • Loading and running tests
        • load_tests Protocol
    • Class and Module Fixtures
      • setUpClass and tearDownClass
      • setUpModule and tearDownModule
    • 信号处理
  • unittest.mock — 仿造对象库
    • Quick Guide
    • The Mock Class
      • 调用
      • Deleting Attributes
      • Mock names and the name attribute
      • Attaching Mocks as Attributes
    • The patchers
      • patch
      • patch.object
      • patch.dict
      • patch.multiple
      • patch methods: start and stop
      • patch builtins
      • TEST_PREFIX
      • Nesting Patch Decorators
      • Where to patch
      • Patching Descriptors and Proxy Objects
    • MagicMock and magic method support
      • Mocking Magic Methods
      • Magic Mock
    • 帮手
      • sentinel
      • DEFAULT
      • call
      • create_autospec
      • ANY
      • FILTER_DIR
      • mock_open
      • Autospeccing
      • Sealing mocks
    • Order of precedence of side_effect , return_value and wraps
  • unittest.mock — 快速入门
    • Using Mock
      • Mock Patching Methods
      • Mock for Method Calls on an Object
      • Mocking Classes
      • Naming your mocks
      • 追踪所有调用
      • Setting Return Values and Attributes
      • Raising exceptions with mocks
      • Side effect functions and iterables
      • Mocking asynchronous iterators
      • Mocking asynchronous context manager
      • Creating a Mock from an Existing Object
      • Using side_effect to return per file content
    • 补丁装饰器
    • Further Examples
      • Mocking chained calls
      • Partial mocking
      • Mocking a Generator Method
      • Applying the same patch to every test method
      • Mocking Unbound Methods
      • Checking multiple calls with mock
      • Coping with mutable arguments
      • 嵌套补丁
      • Mocking a dictionary with MagicMock
      • Mock subclasses and their attributes
      • Mocking imports with patch.dict
      • Tracking order of calls and less verbose call assertions
      • More complex argument matching
  • 2to3 — 自动 Python 2 到 3 代码翻译
    • 使用 2to3
    • Fixers
    • lib2to3 — 2to3’s library
  • test — 用于 Python 的回归测试包
    • 编写单元测试为 test 包
    • Running tests using the command-line interface
  • test.support — 用于 Python 测试套件的实用程序
  • test.support.socket_helper — 用于套接字测试的实用程序
  • test.support.script_helper — 用于 Python 执行测试的实用程序
  • test.support.bytecode_helper — 用于测试正确字节码生成的支持工具
  • test.support.threading_helper — 用于线程测试的实用程序
  • test.support.os_helper — 用于 OS 测试的实用程序
  • test.support.import_helper — 用于导入测试的实用程序
  • test.support.warnings_helper — 用于警告测试的实用程序

上一话题

IDLE

下一话题

typing — 支持类型提示

本页

  • 报告 Bug
  • 展示源

快速搜索

键入搜索术语或模块、类、函数名称。

  1. 首页
  2. Python 3.12.4
  3. 索引
  4. 模块
  5. 下一
  6. 上一
  7. Python 标准库
  8. 开发工具
  9. 版权所有  © 2014-2026 乐数软件    

    工业和信息化部: 粤ICP备14079481号-1