summaryrefslogtreecommitdiffstats
path: root/tests/roots/test-autosummary
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:25:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:25:40 +0000
commitcf7da1843c45a4c2df7a749f7886a2d2ba0ee92a (patch)
tree18dcde1a8d1f5570a77cd0c361de3b490d02c789 /tests/roots/test-autosummary
parentInitial commit. (diff)
downloadsphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.tar.xz
sphinx-cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a.zip
Adding upstream version 7.2.6.upstream/7.2.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/roots/test-autosummary')
-rw-r--r--tests/roots/test-autosummary/conf.py12
-rw-r--r--tests/roots/test-autosummary/dummy_module.py85
-rw-r--r--tests/roots/test-autosummary/index.rst8
-rw-r--r--tests/roots/test-autosummary/sphinx.rst31
-rw-r--r--tests/roots/test-autosummary/underscore_module_.py15
5 files changed, 151 insertions, 0 deletions
diff --git a/tests/roots/test-autosummary/conf.py b/tests/roots/test-autosummary/conf.py
new file mode 100644
index 0000000..46cf4fa
--- /dev/null
+++ b/tests/roots/test-autosummary/conf.py
@@ -0,0 +1,12 @@
+import os
+import sys
+
+sys.path.insert(0, os.path.abspath('.'))
+
+extensions = ['sphinx.ext.autosummary']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+autosummary_generate = True
+
+exclude_patterns = ['_build']
diff --git a/tests/roots/test-autosummary/dummy_module.py b/tests/roots/test-autosummary/dummy_module.py
new file mode 100644
index 0000000..4adc031
--- /dev/null
+++ b/tests/roots/test-autosummary/dummy_module.py
@@ -0,0 +1,85 @@
+"""
+.. autosummary::
+
+ module_attr
+ C.class_attr
+ C.instance_attr
+ C.prop_attr1
+ C.prop_attr2
+ C.C2
+"""
+
+
+def withSentence():
+ '''I have a sentence which
+ spans multiple lines. Then I have
+ more stuff
+ '''
+ pass
+
+
+def noSentence():
+ '''this doesn't start with a
+ capital. so it's not considered
+ a sentence
+ '''
+ pass
+
+
+def emptyLine():
+ '''This is the real summary
+
+ However, it did't end with a period.
+ '''
+ pass
+
+
+#: This is a module attribute
+#:
+#: value is integer.
+module_attr = 1
+
+
+class C:
+ '''
+ My C class
+
+ with class_attr attribute
+ '''
+
+ #: This is a class attribute
+ #:
+ #: value is integer.
+ class_attr = 42
+
+ def __init__(self):
+ #: This is an instance attribute
+ #:
+ #: value is a string
+ self.instance_attr = "42"
+
+ def _prop_attr_get(self):
+ """
+ This is a function docstring
+
+ return value is string.
+ """
+ return 'spam egg'
+
+ prop_attr1 = property(_prop_attr_get)
+
+ prop_attr2 = property(_prop_attr_get)
+ """
+ This is a attribute docstring
+
+ value is string.
+ """
+
+ class C2:
+ '''
+ This is a nested inner class docstring
+ '''
+
+
+def func(arg_, *args, **kwargs):
+ """Test function take an argument ended with underscore."""
diff --git a/tests/roots/test-autosummary/index.rst b/tests/roots/test-autosummary/index.rst
new file mode 100644
index 0000000..5ddc4bd
--- /dev/null
+++ b/tests/roots/test-autosummary/index.rst
@@ -0,0 +1,8 @@
+
+.. autosummary::
+ :nosignatures:
+ :toctree:
+
+ dummy_module
+ underscore_module_
+ sphinx
diff --git a/tests/roots/test-autosummary/sphinx.rst b/tests/roots/test-autosummary/sphinx.rst
new file mode 100644
index 0000000..fc1a35a
--- /dev/null
+++ b/tests/roots/test-autosummary/sphinx.rst
@@ -0,0 +1,31 @@
+Autosummary test
+================
+
+.. autosummary::
+ :toctree: generated
+
+ sphinx.application.Sphinx
+
+.. currentmodule:: sphinx.application
+
+.. autoclass:: TemplateBridge
+
+ Basic test
+
+ .. autosummary::
+
+ render -- some ignored stuff goes here
+ render_string More ignored stuff
+
+ Test with tildes
+
+ .. autosummary::
+
+ ~TemplateBridge.render
+ ~TemplateBridge.render_string
+
+ Methods:
+
+ .. automethod:: render
+
+ .. automethod:: render_string
diff --git a/tests/roots/test-autosummary/underscore_module_.py b/tests/roots/test-autosummary/underscore_module_.py
new file mode 100644
index 0000000..8584e60
--- /dev/null
+++ b/tests/roots/test-autosummary/underscore_module_.py
@@ -0,0 +1,15 @@
+"""
+module with trailing underscores everywhere
+"""
+
+
+class class_:
+ """ Class """
+ def method_(_arg):
+ """ Method """
+ pass
+
+
+def function_(_arg):
+ """ Function """
+ pass