Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inner exceptions are missing #51

Open
davidselassie opened this issue Jan 10, 2024 · 0 comments
Open

Inner exceptions are missing #51

davidselassie opened this issue Jan 10, 2024 · 0 comments

Comments

@davidselassie
Copy link

I have an exception defined as a nested inner class. It ends up being missing from the resulting documentation. Other exceptions and other nested inner classes do appear, though.

class OuterEx(Exception):
    """This exception is in the module.

    This is rendered.
    """
    pass

class ContainingCls:
    """This is the containing class.

    This is rendered.
    """

    class InnerCls:
        """This is an inner regular class.

        This is rendered."""
        pass

    class InnerEx(Exception):
        """This is an inner exception.

        This is missing!
        """
        pass

Resulting RST:

:py:mod:`test_pkg`
==================

.. py:module:: test_pkg

.. autodoc2-docstring:: test_pkg
   :allowtitles:

Package Contents
----------------

Classes
~~~~~~~

.. list-table::
   :class: autosummary longtable
   :align: left

   * - :py:obj:`ContainingCls <test_pkg.ContainingCls>`
     - .. autodoc2-docstring:: test_pkg.ContainingCls
          :summary:

API
~~~

.. py:exception:: OuterEx()
   :canonical: test_pkg.OuterEx

   Bases: :py:obj:`Exception`

   .. autodoc2-docstring:: test_pkg.OuterEx

   .. rubric:: Initialization

   .. autodoc2-docstring:: test_pkg.OuterEx.__init__

.. py:class:: ContainingCls
   :canonical: test_pkg.ContainingCls

   .. autodoc2-docstring:: test_pkg.ContainingCls

   .. py:class:: InnerCls
      :canonical: test_pkg.ContainingCls.InnerCls

      .. autodoc2-docstring:: test_pkg.ContainingCls.InnerCls
davidselassie added a commit to davidselassie/sphinx-autodoc2 that referenced this issue Jan 10, 2024
It looks like when enumerating through the nested children of a class,
the code also needs to list out exceptions. Adds test.

Should fix what I found in
sphinx-extensions2#51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant