Skip to content

Commit 159fe4b

Browse files
committed
add module-level docstring
1 parent 853ebeb commit 159fe4b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

doctests.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Test hook(s) for Doctests in reStructuredText (.rst) Files."""
2+
13
import doctest
24
import os
35
import unittest
@@ -6,7 +8,8 @@
68

79

810
def load_tests(loader: unittest.TestLoader, tests: unittest.TestSuite, ignorex: Any) -> unittest.TestSuite:
9-
"""Discover and add all reStructuredText (.rst) doctest files within the current directory tree to the test suite.
11+
"""
12+
Discover and add all reStructuredText (.rst) doctest files within the current directory tree to the test suite.
1013
1114
Parameters
1215
----------
@@ -27,6 +30,15 @@ def load_tests(loader: unittest.TestLoader, tests: unittest.TestSuite, ignorex:
2730
This function is used by the unittest framework to discover and include additional doctests
2831
in the test suite during test discovery.
2932
33+
Examples
34+
--------
35+
When placed in a test module, unittest will automatically call `load_tests` if it exists.
36+
37+
>>> import unittest
38+
>>> suite = unittest.TestSuite()
39+
>>> loader = unittest.TestLoader()
40+
>>> load_tests(loader, suite, None) # doctest: +ELLIPSIS
41+
<unittest.suite.TestSuite tests=[...]
3042
"""
3143
for root, dirs, files in os.walk("."):
3244
for f in files:
@@ -43,3 +55,4 @@ def load_tests(loader: unittest.TestLoader, tests: unittest.TestSuite, ignorex:
4355
if __name__ == "__main__":
4456
if sys.version_info >= (3, 6):
4557
unittest.main()
58+

0 commit comments

Comments
 (0)