Ferramentas de Desenvolvimento¶
The modules described in this chapter help you write software. For example, the
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.
A lista de módulos descritos neste capítulo é:
typing
— Suporte para dicas de tipo- Especificação para o sistema de tipos do Python
- Apelidos de tipo
- NewType
- Anotações de objetos chamáveis
- Genéricos
- Anotando tuplas
- O tipo de objetos de classe
- Tipos genéricos definidos pelo usuário
- O tipo
Any
- Subtipagem nominal vs estrutural
- Conteúdo do módulo
- Cronograma de Descontinuação dos Principais Recursos
pydoc
— Gerador de documentação e sistema de ajuda online- Modo de Desenvolvimento do Python
doctest
— Teste exemplos interativos de Pythonunittest
— Framework de Testes Unitáriosunittest.mock
— biblioteca de objeto mockunittest.mock
— primeiros passos- Usando Mock
- Métodos de aplicação de patches em Mock
- Mock for Method Calls on an Object
- Mocking Classes
- Nomeando os mocks
- Tracking all Calls
- 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
- Patch Decorators
- 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
- Nesting Patches
- 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
- Usando Mock
test
— Pacote de Testes de Regressão do Pythontest.support
— Utilitários para o conjunto de teste do Pythontest.support.socket_helper
— Utilities for socket teststest.support.script_helper
— Utilities for the Python execution teststest.support.bytecode_helper
— Ferramentas de suporte para testar a geração correta de bytecodetest.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