From cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 19:25:40 +0200 Subject: Adding upstream version 7.2.6. Signed-off-by: Daniel Baumann --- .../autosummary_class_module.py | 2 + .../autosummary_dummy_inherited_module.py | 13 +++++ .../autosummary_dummy_module.py | 68 ++++++++++++++++++++++ .../test-ext-autosummary/autosummary_importfail.py | 2 + tests/roots/test-ext-autosummary/conf.py | 10 ++++ tests/roots/test-ext-autosummary/index.rst | 18 ++++++ 6 files changed, 113 insertions(+) create mode 100644 tests/roots/test-ext-autosummary/autosummary_class_module.py create mode 100644 tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py create mode 100644 tests/roots/test-ext-autosummary/autosummary_dummy_module.py create mode 100644 tests/roots/test-ext-autosummary/autosummary_importfail.py create mode 100644 tests/roots/test-ext-autosummary/conf.py create mode 100644 tests/roots/test-ext-autosummary/index.rst (limited to 'tests/roots/test-ext-autosummary') 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 -- cgit v1.2.3