
unittest — Unit testing framework — Python 3.13.3 documentation
2 days ago · The basic building blocks of unit testing are test cases — single scenarios that must be set up and checked for correctness. In unittest, test cases are represented by …
unittest.mock — getting started — Python 3.13.3 documentation
1 day ago · A common use case is to mock out classes instantiated by your code under test. When you patch a class, then that class is replaced with a mock. Instances are created by …
doctest — Test interactive Python examples — Python 3.13.3 …
2 days ago · Write text files containing test cases as interactive examples, and test the files using testfile() or DocFileSuite(). This is recommended, although is easiest to do for new projects, …
test — Regression tests package for Python — Python 3.13.3 …
2 days ago · The test package can be run as a script to drive Python’s regression test suite, thanks to the -m option: python -m test. Under the hood, it uses test.regrtest ; the call python …
The Python Tutorial — Python 3.13.3 documentation
1 day ago · The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an …
unittest.mock — mock object library — Python 3.13.3 …
2 days ago · unittest.mock is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used. …
25.3. unittest — 单元测试框架 — Python 2.7.18 文档
The basic building blocks of unit testing are test cases — single scenarios that must be set up and checked for correctness. In unittest, test cases are represented by instances of unittest ’s …
__main__ — Top-level code environment — Python 3.13.3 …
20 hours ago · In Python, the special name __main__ is used for two important constructs: the name of the top-level environment of the program, which can be checked using the __name__ …
Regular Expression HOWTO — Python 3.14.0a7 documentation
Apr 23, 2025 · Perform case-insensitive matching; character class and literal strings will match letters by ignoring case. For example, [A-Z] will match lowercase letters, too. Full Unicode …
Built-in Types — Python 3.13.3 documentation
1 day ago · if concatenating str objects, you can build a list and use str.join() at the end or else write to an io.StringIO instance and retrieve its value when complete. if concatenating bytes …