summaryrefslogtreecommitdiffstats
path: root/tests/roots/test-ext-autosummary
diff options
context:
space:
mode:
Diffstat (limited to 'tests/roots/test-ext-autosummary')
-rw-r--r--tests/roots/test-ext-autosummary/autosummary_class_module.py2
-rw-r--r--tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py13
-rw-r--r--tests/roots/test-ext-autosummary/autosummary_dummy_module.py68
-rw-r--r--tests/roots/test-ext-autosummary/autosummary_importfail.py2
-rw-r--r--tests/roots/test-ext-autosummary/conf.py10
-rw-r--r--tests/roots/test-ext-autosummary/index.rst18
6 files changed, 113 insertions, 0 deletions
diff --git a/tests/roots/test-ext-autosummary/autosummary_class_module.py b/tests/roots/test-ext-autosummary/autosummary_class_module.py
new file mode 100644
index 0000000..f13de17
--- /dev/null
+++ b/tests/roots/test-ext-autosummary/autosummary_class_module.py
@@ -0,0 +1,2 @@
+class Class():
+ pass
diff --git a/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py b/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py
new file mode 100644
index 0000000..2b3d2da
--- /dev/null
+++ b/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py
@@ -0,0 +1,13 @@
+from autosummary_dummy_module import Foo
+
+
+class InheritedAttrClass(Foo):
+
+ def __init__(self):
+ #: other docstring
+ self.subclassattr = "subclassattr"
+
+ super().__init__()
+
+
+__all__ = ["InheritedAttrClass"]
diff --git a/tests/roots/test-ext-autosummary/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py
new file mode 100644
index 0000000..2d8829a
--- /dev/null
+++ b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py
@@ -0,0 +1,68 @@
+from os import path
+from typing import Union
+
+from autosummary_class_module import Class
+
+__all__ = [
+ "CONSTANT1",
+ "Exc",
+ "Foo",
+ "_Baz",
+ "bar",
+ "qux",
+ "path",
+]
+
+#: module variable
+CONSTANT1 = None
+CONSTANT2 = None
+
+
+class Foo:
+ #: class variable
+ CONSTANT3 = None
+ CONSTANT4 = None
+
+ class Bar:
+ pass
+
+ def __init__(self):
+ #: docstring
+ self.value = 1
+
+ def bar(self):
+ pass
+
+ @property
+ def baz(self):
+ pass
+
+
+class _Baz:
+ pass
+
+
+def bar(x: Union[int, str], y: int = 1) -> None:
+ pass
+
+
+def _quux():
+ pass
+
+
+class Exc(Exception):
+ pass
+
+
+class _Exc(Exception):
+ pass
+
+
+#: a module-level attribute
+qux = 2
+#: a module-level attribute that has been excluded from __all__
+quuz = 2
+
+considered_as_imported = Class()
+non_imported_member = Class()
+""" This attribute has a docstring, so it is recognized as a not-imported member """
diff --git a/tests/roots/test-ext-autosummary/autosummary_importfail.py b/tests/roots/test-ext-autosummary/autosummary_importfail.py
new file mode 100644
index 0000000..5c6ce56
--- /dev/null
+++ b/tests/roots/test-ext-autosummary/autosummary_importfail.py
@@ -0,0 +1,2 @@
+# Fail module import in a catastrophic way
+raise SystemExit(1)
diff --git a/tests/roots/test-ext-autosummary/conf.py b/tests/roots/test-ext-autosummary/conf.py
new file mode 100644
index 0000000..55c769c
--- /dev/null
+++ b/tests/roots/test-ext-autosummary/conf.py
@@ -0,0 +1,10 @@
+import os
+import sys
+
+sys.path.insert(0, os.path.abspath('.'))
+
+extensions = ['sphinx.ext.autosummary']
+autosummary_generate = True
+
+# The suffix of source filenames.
+source_suffix = '.rst'
diff --git a/tests/roots/test-ext-autosummary/index.rst b/tests/roots/test-ext-autosummary/index.rst
new file mode 100644
index 0000000..08bd0f0
--- /dev/null
+++ b/tests/roots/test-ext-autosummary/index.rst
@@ -0,0 +1,18 @@
+
+:autolink:`autosummary_dummy_module.Foo`
+
+:autolink:`autosummary_importfail`
+
+.. autosummary::
+ :toctree: generated
+ :caption: An autosummary
+
+ autosummary_dummy_module
+ autosummary_dummy_module.Foo
+ autosummary_dummy_module.Foo.Bar
+ autosummary_dummy_module.Foo.value
+ autosummary_dummy_module.bar
+ autosummary_dummy_module.qux
+ autosummary_dummy_inherited_module.InheritedAttrClass
+ autosummary_dummy_inherited_module.InheritedAttrClass.subclassattr
+ autosummary_importfail