]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-44538: Mention nested classes/functions in doctest docs (GH-137870) (#137918)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 27 Aug 2025 14:01:55 +0000 (16:01 +0200)
committerGitHub <noreply@github.com>
Wed, 27 Aug 2025 14:01:55 +0000 (17:01 +0300)
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Doc/library/doctest.rst

index 82e570a2a85cd7ed7a53b7d11e4c4463f26e32b9..61463d6adcd1431a684fd1bb7b2c37bde780d8a6 100644 (file)
@@ -350,6 +350,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: