https://github.com/python/cpython/commit/d1882577a32125870c0bc8030d90221068b6b071 commit: d1882577a32125870c0bc8030d90221068b6b071 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: ZeroIntensity <[email protected]> date: 2025-08-18T15:05:12Z summary:
[3.13] gh-44538: Mention nested classes/functions in doctest docs (GH-137870) (GH-137917) gh-44538: Mention nested classes/functions in doctest docs (GH-137870) (cherry picked from commit 138ed6db9f89171983dc32af4e7ad2e73d46a940) Co-authored-by: Bartosz Sławecki <[email protected]> files: M Doc/library/doctest.rst diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index d1ccfc20981523..e6f89ea981acd8 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -346,6 +346,13 @@ searches them recursively for docstrings, which are then scanned for tests. Any classes found are recursively searched similarly, to test docstrings in their contained methods and nested classes. +.. note:: + + ``doctest`` can only automatically discover classes and functions that are + defined at the module level or inside other classes. + + Since nested classes and functions only exist when an outer function + is called, they cannot be discovered. Define them outside to make them visible. .. _doctest-finding-examples: _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
