Skip to content

Commit a4191c5

Browse files
committed
Test automodsumm_special_methods_of option
Signed-off-by: Conor MacBride <[email protected]>
1 parent ac8feee commit a4191c5

8 files changed

+104
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Documenting a module with classes, also including special methods
2+
for a particular list of classes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. automodapi:: sphinx_automodapi.tests.example_module.private_classes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Banana
2+
======
3+
4+
.. currentmodule:: sphinx_automodapi.tests.example_module.private_classes
5+
6+
.. autoclass:: Banana
7+
:show-inheritance:
8+
9+
.. rubric:: Methods Summary
10+
11+
.. autosummary::
12+
13+
~Banana.eat
14+
15+
.. rubric:: Methods Documentation
16+
17+
.. automethod:: eat
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Fruit
2+
=====
3+
4+
.. currentmodule:: sphinx_automodapi.tests.example_module.private_classes
5+
6+
.. autoclass:: Fruit
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~Fruit.weight
14+
15+
.. rubric:: Methods Summary
16+
17+
.. autosummary::
18+
19+
~Fruit.__len__
20+
~Fruit.buy
21+
~Fruit.eat
22+
23+
.. rubric:: Attributes Documentation
24+
25+
.. autoattribute:: weight
26+
27+
.. rubric:: Methods Documentation
28+
29+
.. automethod:: __len__
30+
.. automethod:: buy
31+
.. automethod:: eat
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Orange
2+
======
3+
4+
.. currentmodule:: sphinx_automodapi.tests.example_module.private_classes
5+
6+
.. autoclass:: Orange
7+
:show-inheritance:
8+
9+
.. rubric:: Methods Summary
10+
11+
.. autosummary::
12+
13+
~Orange.__add__
14+
~Orange.eat
15+
16+
.. rubric:: Methods Documentation
17+
18+
.. automethod:: __add__
19+
.. automethod:: eat
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
sphinx_automodapi.tests.example_module.private_classes Module
3+
-------------------------------------------------------------
4+
5+
.. automodule:: sphinx_automodapi.tests.example_module.private_classes
6+
7+
Classes
8+
^^^^^^^
9+
10+
.. automodsumm:: sphinx_automodapi.tests.example_module.private_classes
11+
:classes-only:
12+
:toctree: api
13+
14+
Class Inheritance Diagram
15+
^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+
.. automod-diagram:: sphinx_automodapi.tests.example_module.private_classes
18+
:private-bases:
19+
:parts: 1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. currentmodule:: sphinx_automodapi.tests.example_module.private_classes
2+
3+
.. autosummary::
4+
:toctree: api
5+
6+
Fruit
7+
Banana
8+
Orange
9+

sphinx_automodapi/tests/test_cases.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ def test_run_full_case(tmpdir, case_dir, parallel):
8383
'sphinx_automodapi.tests.example_module.private_classes.Fruit',
8484
'sphinx_automodapi.tests.example_module.private_classes.Banana',
8585
]
86+
if os.path.basename(case_dir) == 'special_methods':
87+
conf['automodsumm_special_methods_of'] = [
88+
'sphinx_automodapi.tests.example_module.private_classes.Fruit',
89+
'sphinx_automodapi.tests.example_module.private_classes.Orange',
90+
]
91+
8692
start_dir = os.path.abspath('.')
8793

8894
src_dir = 'src' if 'source_dir' in case_dir else '.'

0 commit comments

Comments
 (0)