開発ツール¶
この章で紹介されるモジュールはソフトウェアを書くことを支援します。たとえば、 pydoc モジュールはモジュールの内容からドキュメントを生成します。 doctest と unittest モジュールでは、自動的に実行して予想通りの出力が生成されるか確認するユニットテストを書くことができます。
この章で解説されるモジュールのリスト:
typing--- 型ヒントのサポートpydoc--- ドキュメント生成とオンラインヘルプシステム- Python 開発モード
doctest--- 対話型の Python の例をテストするunittest--- ユニットテストフレームワークunittest.mock--- モックオブジェクトライブラリunittest.mock--- 入門- Mock を使う
- Mock patching methods
- Mock for method calls on an object
- Mocking classes
- モックに名前をつける
- Tracking all calls
- Setting return values and attributes
- モックから例外を発生させる
- side_effect の関数と iterable
- 非同期イテレータをモックする
- 非同期コンテキストマネージャをモックする
- Creating a mock from an existing object
- Using side_effect to return per file content
- Patch decorators
- Further examples
- Mock を使う
test--- Regression tests package for Pythontest.support--- Utilities for the Python test suitetest.support.socket_helper--- Utilities for socket teststest.support.script_helper--- Utilities for the Python execution teststest.support.bytecode_helper--- Support tools for testing correct bytecode generationtest.support.threading_helper--- Utilities for threading teststest.support.os_helper--- Utilities for os teststest.support.import_helper--- Utilities for import teststest.support.warnings_helper--- Utilities for warnings tests