diff options
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/doctest.rst | 15 | ||||
-rw-r--r-- | Doc/library/sqlite3.rst | 2 | ||||
-rw-r--r-- | Doc/library/struct.rst | 16 |
3 files changed, 16 insertions, 17 deletions
diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index d587c7507d..5cabc5e0ae 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -972,18 +972,17 @@ serious Python testing frameworks build on the :mod:`unittest` module, which supplies many flexible ways to combine tests from multiple sources. So, in Python 2.4, :mod:`doctest`'s :class:`Tester` class is deprecated, and :mod:`doctest` provides two functions that can be used to create :mod:`unittest` -test suites from modules and text files containing doctests. These test suites -can then be run using :mod:`unittest` test runners:: +test suites from modules and text files containing doctests. To integrate with +:mod:`unittest` test discovery, include a :func:`load_tests` function in your +test module:: import unittest import doctest - import my_module_with_doctests, and_another + import my_module_with_doctests - suite = unittest.TestSuite() - for mod in my_module_with_doctests, and_another: - suite.addTest(doctest.DocTestSuite(mod)) - runner = unittest.TextTestRunner() - runner.run(suite) + def load_tests(loader, tests, ignore): + tests.addTests(doctest.DocTestSuite(my_module_with_doctests)) + return test There are two main functions for creating :class:`unittest.TestSuite` instances from text files and modules with doctests: diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index cf38373ab8..cf2e678cb6 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -138,7 +138,7 @@ Module functions and constants first blank for the column name: the column name would simply be "x". -.. function:: connect(database[, timeout, isolation_level, detect_types, factory]) +.. function:: connect(database[, timeout, detect_types, isolation_level, check_same_thread, factory, cached_statements]) Opens a connection to the SQLite database file *database*. You can use ``":memory:"`` to open a database connection to a database that resides in RAM diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst index b5fd43278f..0b8052c40d 100644 --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -263,14 +263,14 @@ specified number of bytes. As a special case, ``'0s'`` means a single, empty string (while ``'0c'`` means 0 characters). The ``'p'`` format character encodes a "Pascal string", meaning a short -variable-length string stored in a fixed number of bytes. The count is the total -number of bytes stored. The first byte stored is the length of the string, or -255, whichever is smaller. The bytes of the string follow. If the string -passed in to :func:`pack` is too long (longer than the count minus 1), only the -leading count-1 bytes of the string are stored. If the string is shorter than -count-1, it is padded with null bytes so that exactly count bytes in all are -used. Note that for :func:`unpack`, the ``'p'`` format character consumes count -bytes, but that the string returned can never contain more than 255 characters. +variable-length string stored in a *fixed number of bytes*, given by the count. +The first byte stored is the length of the string, or 255, whichever is smaller. +The bytes of the string follow. If the string passed in to :func:`pack` is too +long (longer than the count minus 1), only the leading ``count-1`` bytes of the +string are stored. If the string is shorter than ``count-1``, it is padded with +null bytes so that exactly count bytes in all are used. Note that for +:func:`unpack`, the ``'p'`` format character consumes count bytes, but that the +string returned can never contain more than 255 characters. For the ``'P'`` format character, the return value is a Python integer or long integer, depending on the size needed to hold a pointer when it has been cast to |