Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-autodocsumm for openSUSE:Factory checked in at 2024-10-25 19:18:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-autodocsumm (Old) and /work/SRC/openSUSE:Factory/.python-autodocsumm.new.2020 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-autodocsumm" Fri Oct 25 19:18:59 2024 rev:16 rq:1218088 version:0.2.14 Changes: -------- --- /work/SRC/openSUSE:Factory/python-autodocsumm/python-autodocsumm.changes 2024-08-30 13:29:35.995437805 +0200 +++ /work/SRC/openSUSE:Factory/.python-autodocsumm.new.2020/python-autodocsumm.changes 2024-10-25 19:19:32.846388112 +0200 @@ -1,0 +2,9 @@ +Thu Oct 24 11:58:10 UTC 2024 - Nico Krapp <nico.krapp@suse.com> + +- Update to 0.2.14 + * Fix ObjectMember related deprecation/removal by @theOehrly + * Type hint mixin base class, fix some more minor style and typing issues by @theOehrly + * Don't document class attributes that are an alias to another object by @theOehrly + * Autoexception support by @Chilipp + +------------------------------------------------------------------- Old: ---- autodocsumm-0.2.13.tar.gz New: ---- autodocsumm-0.2.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-autodocsumm.spec ++++++ --- /var/tmp/diff_new_pack.QccsSS/_old 2024-10-25 19:19:33.322407972 +0200 +++ /var/tmp/diff_new_pack.QccsSS/_new 2024-10-25 19:19:33.326408139 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-autodocsumm -Version: 0.2.13 +Version: 0.2.14 Release: 0 Summary: Extended sphinx autodoc including automatic autosummaries License: Apache-2.0 ++++++ autodocsumm-0.2.13.tar.gz -> autodocsumm-0.2.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/.github/workflows/python-app.yml new/autodocsumm-0.2.14/.github/workflows/python-app.yml --- old/autodocsumm-0.2.13/.github/workflows/python-app.yml 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/.github/workflows/python-app.yml 2024-10-21 14:26:29.000000000 +0200 @@ -75,31 +75,3 @@ "sphinxcontrib-jsmath<1.0.1" "sphinxcontrib-qthelp<1.0.7" "sphinxcontrib-serializinghtml<1.1.10"' - - - build-legacy-sphinx-30plus: - name: Build - - strategy: - fail-fast: false - matrix: - python-version: [ "3.7", "3.8", "3.9" ] - sphinx-version: [ - "3.0.*", # possible range: 3.0.0 - 3.5.4 - ] - include: - - python-version: "3.7" - sphinx-version: "3.5.*" # latest version that supports py3.7 - uses: ./.github/workflows/build.yml - with: - python-version: ${{ matrix.python-version }} - extra-requirements: '\ - "sphinx==${{ matrix.sphinx-version }}" - "jinja2<3.1" - "alabaster<0.7.14" - "sphinxcontrib-applehelp<1.0.8" - "sphinxcontrib-devhelp<1.0.6" - "sphinxcontrib-htmlhelp<2.0.5" - "sphinxcontrib-jsmath<1.0.1" - "sphinxcontrib-qthelp<1.0.7" - "sphinxcontrib-serializinghtml<1.1.10"' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/autodocsumm/__init__.py new/autodocsumm-0.2.14/autodocsumm/__init__.py --- old/autodocsumm-0.2.13/autodocsumm/__init__.py 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/autodocsumm/__init__.py 2024-10-21 14:26:29.000000000 +0200 @@ -40,6 +40,7 @@ __status__ = "Production" from itertools import chain +from typing import TYPE_CHECKING from sphinx.util import logging import re @@ -52,8 +53,8 @@ from sphinx.ext.autodoc import ( ClassDocumenter, ModuleDocumenter, ALL, PycodeError, - ModuleAnalyzer, AttributeDocumenter, DataDocumenter, Options, - prepare_docstring) + ModuleAnalyzer, AttributeDocumenter, DataDocumenter, Options, ExceptionDocumenter, + Documenter, prepare_docstring) import sphinx.ext.autodoc as ad signature = Signature = None @@ -82,6 +83,12 @@ __version__ = _version.get_versions()['version'] +if TYPE_CHECKING: # pragma: no cover + DOCUMENTER_MIXIN_BASE = Documenter +else: + DOCUMENTER_MIXIN_BASE = object + + logger = logging.getLogger(__name__) #: Options of the :class:`sphinx.ext.autodoc.ModuleDocumenter` that have an @@ -125,7 +132,7 @@ return default -class AutosummaryDocumenter(object): +class AutosummaryDocumenter(DOCUMENTER_MIXIN_BASE): """Abstract class for for extending Documenter methods This classed is used as a base class for Documenters in order to provide @@ -137,6 +144,8 @@ #: Grouper functions grouper_funcs = [] + member_sections: dict + def __init__(self): raise NotImplementedError @@ -220,8 +229,16 @@ # remove members given by exclude-members if self.options.exclude_members: - members = [(membername, member) for (membername, member) in members - if membername not in self.options.exclude_members] + try: + members = [ + member for member in members + if member.__name__ not in self.options.exclude_members + ] + except AttributeError: # Sphinx<3.4.0 + members = [ + (membername, member) for (membername, member) in members + if membername not in self.options.exclude_members + ] # document non-skipped members memberdocumenters = [] @@ -279,7 +296,6 @@ else: return documenters - def add_autosummary(self, relative_ref_paths=False): """Add the autosammary table of this documenter. @@ -333,7 +349,7 @@ #: slightly higher priority than #: :class:`sphinx.ext.autodoc.ModuleDocumenter` - priority = ModuleDocumenter.priority + 0.1 + priority = ModuleDocumenter.priority + 0.1 # type: ignore[assignment] #: original option_spec from :class:`sphinx.ext.autodoc.ModuleDocumenter` #: but with additional autosummary boolean option @@ -383,7 +399,7 @@ #: slightly higher priority than #: :class:`sphinx.ext.autodoc.ClassDocumenter` - priority = ClassDocumenter.priority + 0.1 + priority = ClassDocumenter.priority + 0.1 # type: ignore[assignment] #: original option_spec from :class:`sphinx.ext.autodoc.ClassDocumenter` #: but with additional autosummary boolean option @@ -414,14 +430,71 @@ def add_content(self, *args, **kwargs): super().add_content(*args, **kwargs) - self.add_autosummary(relative_ref_paths=True) + # If the class is already documented under another name, Sphinx + # documents it as data/attribute. In this case, we do not want to + # generate an autosummary of the class for the attribute (see #69). + if not self.doc_as_attr: + self.add_autosummary(relative_ref_paths=True) + + +class AutoSummExceptionDocumenter(ExceptionDocumenter, AutosummaryDocumenter): + """Exception Documenter with autosummary tables for its members. + + This class has the same functionality as the base + :class:`sphinx.ext.autodoc.ExceptionDocumenter` class but with an + additional `autosummary` option to provide the ability to provide a summary + of all methods and attributes. + It's priority is slightly higher than the one of the ExceptionDocumenter + """ + + #: slightly higher priority than + #: :class:`sphinx.ext.autodoc.ExceptionDocumenter` + priority = ExceptionDocumenter.priority + 0.1 # type: ignore[assignment] + + #: original option_spec from + #: :class:`sphinx.ext.autodoc.ExceptionDocumenter` but with additional + #: autosummary boolean option + option_spec = ExceptionDocumenter.option_spec.copy() + option_spec['autosummary'] = bool_option + option_spec['autosummary-no-nesting'] = bool_option + option_spec['autosummary-sections'] = list_option + option_spec['autosummary-no-titles'] = bool_option + option_spec['autosummary-force-inline'] = bool_option + option_spec['autosummary-nosignatures'] = bool_option + + #: Add options for members for the autosummary + for _option in member_options.intersection(option_spec): + option_spec['autosummary-' + _option] = option_spec[_option] + del _option + + member_sections = { + ad.ExceptionDocumenter.member_order: 'Classes', + ad.MethodDocumenter.member_order: 'Methods', + ad.AttributeDocumenter.member_order: 'Attributes', + } + """:class:`dict` that includes the autosummary sections + + This dictionary defines the sections for the autosummmary option. The + values correspond to the :attr:`sphinx.ext.autodoc.Documenter.member_order` + attribute that shall be used for each section.""" + + def add_content(self, *args, **kwargs): + super().add_content(*args, **kwargs) + + # If the class is already documented under another name, Sphinx + # documents it as data/attribute. In this case, we do not want to + # generate an autosummary of the class for the attribute (see #69). + if not self.doc_as_attr: + self.add_autosummary(relative_ref_paths=True) class CallableDataDocumenter(DataDocumenter): """:class:`sphinx.ext.autodoc.DataDocumenter` that uses the __call__ attr """ - priority = DataDocumenter.priority + 0.1 + #: slightly higher priority than + #: :class:`sphinx.ext.autodoc.DataDocumenter` + priority = DataDocumenter.priority + 0.1 # type: ignore[assignment] def format_args(self): # for classes, the relevant signature is the __init__ method's @@ -454,6 +527,8 @@ doc = [] for docstring in docstrings: + encoding = _get_arg("encoding", 0, None, *args, **kwargs) + ignore = _get_arg("ignore", 1, 1, *args, **kwargs) if not isinstance(docstring, str): docstring = force_decode(docstring, encoding) doc.append(prepare_docstring(docstring, ignore)) @@ -466,7 +541,9 @@ attr """ - priority = AttributeDocumenter.priority + 0.1 + #: slightly higher priority than + #: :class:`sphinx.ext.autodoc.AttributeDocumenter` + priority = AttributeDocumenter.priority + 0.1 # type: ignore[assignment] def format_args(self): # for classes, the relevant signature is the __init__ method's @@ -545,7 +622,7 @@ """DataDocumenter that prevents the displaying of large data""" #: slightly higher priority as the one of the CallableDataDocumenter - priority = CallableDataDocumenter.priority + 0.1 + priority = CallableDataDocumenter.priority + 0.1 # type: ignore[assignment] def __init__(self, *args, **kwargs): super(NoDataDataDocumenter, self).__init__(*args, **kwargs) @@ -560,7 +637,7 @@ """AttributeDocumenter that prevents the displaying of large data""" #: slightly higher priority as the one of the CallableAttributeDocumenter - priority = CallableAttributeDocumenter.priority + 0.1 + priority = CallableAttributeDocumenter.priority + 0.1 # type: ignore[assignment] def __init__(self, *args, **kwargs): super(NoDataAttributeDocumenter, self).__init__(*args, **kwargs) @@ -576,13 +653,15 @@ Usage:: - .. autoclasssum:: <Class> + .. autoclasssumm:: <Class> + + .. automodsumm:: <module> - .. automodsum:: <module> + .. autoexceptionsumm:: <ExceptionClass> - The directive additionally supports all options of the ``autoclass`` or - ``automod`` directive respectively. Sections can be a list of section titles - to be included. If ommitted, all sections are used. + The directive additionally supports all options of the ``autoclass``, + ``automod``, or ``autoexception`` directive respectively. Sections can be a + list of section titles to be included. If ommitted, all sections are used. """ has_content = False @@ -596,9 +675,9 @@ reporter = self.state.document.reporter try: - source, lineno = reporter.get_source_and_line(self.lineno) + _, lineno = reporter.get_source_and_line(self.lineno) except AttributeError: - source, lineno = (None, None) + _, lineno = (None, None) # look up target Documenter objtype = self.name[4:-4] # strip prefix (auto-) and suffix (-summ). @@ -639,6 +718,7 @@ app.setup_extension('sphinx.ext.autosummary') app.setup_extension('sphinx.ext.autodoc') app.add_directive('autoclasssumm', AutoDocSummDirective) + app.add_directive('autoexceptionsumm', AutoDocSummDirective) app.add_directive('automodulesumm', AutoDocSummDirective) AUTODOC_DEFAULT_OPTIONS.extend( @@ -653,7 +733,7 @@ registry = app.registry.documenters for cls in [AutoSummClassDocumenter, AutoSummModuleDocumenter, CallableAttributeDocumenter, NoDataDataDocumenter, - NoDataAttributeDocumenter]: + NoDataAttributeDocumenter, AutoSummExceptionDocumenter]: if not issubclass(registry.get(cls.objtype), cls): app.add_autodocumenter(cls, override=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/autodocsumm/_version.py new/autodocsumm-0.2.14/autodocsumm/_version.py --- old/autodocsumm-0.2.13/autodocsumm/_version.py 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/autodocsumm/_version.py 2024-10-21 14:26:29.000000000 +0200 @@ -26,9 +26,9 @@ # setup.py/versioneer.py will grep for the variable names, so they must # each be defined on a line of their own. _version.py will just call # get_keywords(). - git_refnames = " (HEAD -> master, tag: v0.2.13)" - git_full = "354e67b443fe212401b1fc0f9e2f0d669c5852c4" - git_date = "2024-08-05 14:07:09 +0200" + git_refnames = " (HEAD -> master, tag: v0.2.14)" + git_full = "f81147eff409d6de19564752c1e6182362b23e04" + git_date = "2024-10-21 14:26:29 +0200" keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} return keywords diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/docs/conf_settings.rst new/autodocsumm-0.2.14/docs/conf_settings.rst --- old/autodocsumm-0.2.13/docs/conf_settings.rst 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/docs/conf_settings.rst 2024-10-21 14:26:29.000000000 +0200 @@ -78,6 +78,11 @@ By default, this directives also sets the `:members:` option unless you specify `:no-members`. +.. rst:directive:: autoexceptionsumm + + The same as the ``autoclasssumm`` directive, just for an ``Exception`` + subclass. + .. rst:directive:: automodulesumm The same as the ``autoclasssumm`` directive, just for a module. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/docs/demo_exception.rst new/autodocsumm-0.2.14/docs/demo_exception.rst --- old/autodocsumm-0.2.13/docs/demo_exception.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/autodocsumm-0.2.14/docs/demo_exception.rst 2024-10-21 14:26:29.000000000 +0200 @@ -0,0 +1,8 @@ +.. _demo_exception: + +Demo Exception +============== + +.. autoexception:: dummy.MyException + :members: + :noindex: \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/docs/dummy.py new/autodocsumm-0.2.14/docs/dummy.py --- old/autodocsumm-0.2.13/docs/dummy.py 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/docs/dummy.py 2024-10-21 14:26:29.000000000 +0200 @@ -22,5 +22,18 @@ some_other_attr = None +class MyException(object): + """Some Exception + + With some description""" + + def do_something_exceptional(self): + """Do something exceptional""" + pass + + #: Any instance attribute + some_exception_attr = None + + #: Some module data large_data = 'Whatever' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/docs/examples.rst new/autodocsumm-0.2.14/docs/examples.rst --- old/autodocsumm-0.2.13/docs/examples.rst 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/docs/examples.rst 2024-10-21 14:26:29.000000000 +0200 @@ -8,6 +8,7 @@ Demo Module <demo_module> Demo Class <demo_class> + Demo Exception <demo_exception> Demo Grouper <demo_grouper> Including a table of contents @@ -24,11 +25,16 @@ produces :ref:`this <demo_module>`. And:: - .. autoclass:: dummy.SomeClass + .. autoclass:: dummy.MyClass :members: :autosummary: -produces :ref:`this <demo_class>`. +produces :ref:`this <demo_class>`, and for exceptions:: + + .. autoexception:: dummy.MyException + :members: + :autosummary: +produces :ref:`this <demo_exception>`. By default, module members are (mainly) grouped according into *Functions*, *Classes* and *Data*, class members are grouped into *Methods* and @@ -178,8 +184,8 @@ Multiple sections might be separated by `;;`, e.g. ``:autosummary-sections: Methods ;; Attributes``. -This also works for the ``autoclasssumm`` and ``automodulesumm`` directives, -e.g.:: +This also works for the ``autoclasssumm``, ``autoexceptionsumm`` and +``automodulesumm`` directives, e.g.:: .. autoclasssumm:: dummy.SomeClass :autosummary-sections: Methods diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/pyproject.toml new/autodocsumm-0.2.14/pyproject.toml --- old/autodocsumm-0.2.13/pyproject.toml 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/pyproject.toml 2024-10-21 14:26:29.000000000 +0200 @@ -33,7 +33,7 @@ requires-python = '>= 3.7' dependencies = [ - 'Sphinx >= 2.2, < 9.0', + 'Sphinx >= 4.0, < 9.0', ] [project.urls] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/tests/test-root/dummy.py new/autodocsumm-0.2.14/tests/test-root/dummy.py --- old/autodocsumm-0.2.13/tests/test-root/dummy.py 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/tests/test-root/dummy.py 2024-10-21 14:26:29.000000000 +0200 @@ -67,6 +67,18 @@ small_data = 'Should be skipped' +class TestException(Exception): + """Exception test for autosummary""" + + def __init__(self): + #: This is an exception attribute + self.exception_instance_attribute = 1 + + def test_exception_method(self): + """Test if the method is included""" + pass + + class InheritedTestClass(TestClass): """Class test for inherited attributes""" @@ -84,6 +96,14 @@ pass +class TestClassWithRefToOtherClass: + """Class test for the autodocsummary when a class attribute is a reference + to another class. No autosummary of the class should be generated for + the attribute. See also issue #69""" + + foo = TestClass + + #: data to be skipped large_data = 'Should also be skipped' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/tests/test-root/index.rst new/autodocsumm-0.2.14/tests/test-root/index.rst --- old/autodocsumm-0.2.13/tests/test-root/index.rst 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/tests/test-root/index.rst 2024-10-21 14:26:29.000000000 +0200 @@ -5,6 +5,7 @@ test_module test_module_summary_only + test_module_exclude_members test_class test_class_order test_class_summary_only diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/tests/test-root/test_autoexceptionsumm.rst new/autodocsumm-0.2.14/tests/test-root/test_autoexceptionsumm.rst --- old/autodocsumm-0.2.13/tests/test-root/test_autoexceptionsumm.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/autodocsumm-0.2.14/tests/test-root/test_autoexceptionsumm.rst 2024-10-21 14:26:29.000000000 +0200 @@ -0,0 +1,4 @@ +Autoexceptionsumm of Dummy Exception +==================================== + +.. autoexceptionsumm:: dummy.TestException diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/tests/test-root/test_class_with_ref_to_other_class.rst new/autodocsumm-0.2.14/tests/test-root/test_class_with_ref_to_other_class.rst --- old/autodocsumm-0.2.13/tests/test-root/test_class_with_ref_to_other_class.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/autodocsumm-0.2.14/tests/test-root/test_class_with_ref_to_other_class.rst 2024-10-21 14:26:29.000000000 +0200 @@ -0,0 +1,6 @@ +Autoclasssumm of Dummy Class +============================ + +.. autoclass:: dummy.TestClassWithRefToOtherClass + :members: + :autosummary: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/tests/test-root/test_exception.rst new/autodocsumm-0.2.14/tests/test-root/test_exception.rst --- old/autodocsumm-0.2.13/tests/test-root/test_exception.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/autodocsumm-0.2.14/tests/test-root/test_exception.rst 2024-10-21 14:26:29.000000000 +0200 @@ -0,0 +1,4 @@ +Dummy Exception Doc +=================== + +.. autoexception:: dummy.TestException \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/tests/test-root/test_module_exclude_members.rst new/autodocsumm-0.2.14/tests/test-root/test_module_exclude_members.rst --- old/autodocsumm-0.2.13/tests/test-root/test_module_exclude_members.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/autodocsumm-0.2.14/tests/test-root/test_module_exclude_members.rst 2024-10-21 14:26:29.000000000 +0200 @@ -0,0 +1,5 @@ +Docs of dummy test without some members +======================================= + +.. automodule:: dummy + :autosummary-exclude-members: InheritedTestClass, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autodocsumm-0.2.13/tests/test_autodocsumm.py new/autodocsumm-0.2.14/tests/test_autodocsumm.py --- old/autodocsumm-0.2.13/tests/test_autodocsumm.py 2024-08-05 14:07:09.000000000 +0200 +++ new/autodocsumm-0.2.14/tests/test_autodocsumm.py 2024-10-21 14:26:29.000000000 +0200 @@ -252,6 +252,17 @@ 'DummySection' ) + def test_exception(self, app): + app.build() + html = get_html(app, 'test_exception.html') + + if sphinx_version[:2] > [3, 1]: + assert in_autosummary("exception_instance_attribute", html) + elif sphinx_version[:2] < [3, 1]: + assert in_autosummary("TestException.exception_instance_attribute", html) + + assert in_autosummary("test_exception_method", html) + @pytest.mark.skipif( sphinx_version[:2] < [3, 1], reason="Only available for sphinx>=3" ) @@ -322,6 +333,22 @@ assert '()' not in html + def test_class_no_summary_for_reference_to_class(self, app): + # see also: issue #69 + app.build() + + html = get_html(app, 'test_class_with_ref_to_other_class.html') + + # assert that the class itself has an autosummary that contains its + # attributes + assert in_autosummary("foo", html) + + # Assert that there is no autosummary of the attribute that is an alias + # of another class. This autosummary would contain attrs/methods/... + # of the referenced class. + assert not in_autosummary("test_method", html) + assert not in_autosummary("test_attr", html) + def test_inherited(self, app): app.build() html = get_html(app, 'test_inherited.html') @@ -396,6 +423,19 @@ assert in_autosummary("test_method", html) assert in_autosummary("test_attr", html) + def test_autoexceptionsumm(self, app): + """Test building the autosummary of a class.""" + app.build() + + html = get_html(app, 'test_autoexceptionsumm.html') + + # the class docstring must not be in the html + assert "Class exception for autosummary" not in html + + # test if the methods and attributes are there in a table + assert in_autosummary("test_exception_method", html) + assert in_autosummary("exception_instance_attribute", html) + def test_autoclasssumm_no_titles(self, app): """Test building the autosummary of a class.""" app.build() @@ -484,6 +524,17 @@ assert '()' not in html + def test_automodulesumm_exclude_members(self, app): + """Test building the autosummary of a module with some members + excluded from the autosummary.""" + app.build() + + html = get_html(app, 'test_module_exclude_members.html') + + assert in_autosummary("TestClass", html) + assert not in_autosummary("InheritedTestClass", html) + + def test_empty(self, app): app.build()