Εργαλεία Ανάπτυξης¶
Τα modules που περιγράφονται σε αυτό το κεφάλαιο σας βοηθούν να γράψετε λογισμικό. Για παράδειγμα, το module pydoc
παίρνει ένα module και δημιουργεί τεκμηρίωση βάσει του περιεχομένου του. Τα modules doctest
και unittest
παρέχουν πλαίσια για τη συγγραφή ελέγχων μονάδας που εκτελούν αυτόματα τον κώδικα και επαληθεύουν ότι παράγεται το αναμενόμενο αποτέλεσμα.
Ο κατάλογος των modules που περιγράφονται σε αυτό το κεφάλαιο είναι:
typing
— Support for type hints- Specification for the Python Type System
- Type aliases
- NewType
- Annotating callable objects
- Generics
- Annotating tuples
- The type of class objects
- Annotating generators and coroutines
- User-defined generic types
- The
Any
type - Nominal vs structural subtyping
- Module contents
- Deprecation Timeline of Major Features
pydoc
— Documentation generator and online help system- Python Development Mode
doctest
— Test interactive Python examplesunittest
— Unit testing frameworkunittest.mock
— mock object libraryunittest.mock
— getting started- Using Mock
- Mock Patching Methods
- Mock for Method Calls on an Object
- Mocking Classes
- Naming your 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
- Using 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