-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for autosummary with autodoc-pydantic
- Loading branch information
1 parent
5ab45c1
commit 200575b
Showing
5 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
tests/roots/test-ext-autosummary-pydantic/_templates/autosummary/module.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{{ fullname | escape | underline}} | ||
|
||
.. automodule:: {{ fullname }} | ||
|
||
{% block attribute %} | ||
{% if attribute %} | ||
.. rubric:: {{ _('Module Attributes') }} | ||
|
||
.. autosummary:: | ||
{% for item in attribute %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block function %} | ||
{% if function %} | ||
.. rubric:: {{ _('Functions') }} | ||
|
||
.. autosummary:: | ||
{% for item in function %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block class %} | ||
{% if class %} | ||
.. rubric:: {{ _('Classes') }} | ||
|
||
.. autosummary:: | ||
{% for item in class %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block pydantic_model %} | ||
{% if pydantic_model %} | ||
.. rubric:: {{ _('Models') }} | ||
|
||
.. autosummary:: | ||
:toctree: | ||
{% for item in pydantic_model %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block pydantic_settings %} | ||
{% if pydantic_settings %} | ||
.. rubric:: {{ _('Settings') }} | ||
|
||
.. autosummary:: | ||
:toctree: | ||
{% for item in pydantic_settings %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block exception %} | ||
{% if exception %} | ||
.. rubric:: {{ _('Exceptions') }} | ||
|
||
.. autosummary:: | ||
{% for item in exception %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block modules %} | ||
{% if modules %} | ||
.. rubric:: {{ _('Modules') }} | ||
|
||
.. autosummary:: | ||
:toctree: | ||
:recursive: | ||
{% for item in modules %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} |
9 changes: 9 additions & 0 deletions
9
tests/roots/test-ext-autosummary-pydantic/autosummary_dummy_module_with_pydantic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
__all__ = [ | ||
"MyModel", | ||
] | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class MyModel(BaseModel): | ||
attr: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath('.')) | ||
|
||
extensions = ['sphinx.ext.autosummary', "sphinxcontrib.autodoc_pydantic"] | ||
autosummary_generate = True | ||
|
||
# The suffix of source filenames. | ||
source_suffix = '.rst' | ||
|
||
templates_path = ["_templates"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
test-ext-autosummary-pydantic | ||
============================= | ||
|
||
.. autosummary:: | ||
:toctree: generated | ||
:recursive: | ||
|
||
autosummary_dummy_module_with_pydantic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters