8000 Add test case that mixes attributes with properties · astropy/sphinx-automodapi@80641ef · GitHub
[go: up one dir, main page]

Skip to 8000 content

Commit 80641ef

Browse files
Add test case that mixes attributes with properties
1 parent 53499bb commit 80641ef

File tree

9 files changed

+125
-0
lines changed

9 files changed

+125
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This example is to make sure that classes can have attributes and properties
2+
and they can be distiguished if ``automodsumm_properties_are_attributes = False``
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. automodapi:: sphinx_automodapi.tests.example_module.attribute_class
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ClassWithAttribute
2+
==================
3+
4+
.. currentmodule:: sphinx_automodapi.tests.example_module.attribute_class
5+
6+
.. autoclass:: ClassWithAttribute
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~ClassWithAttribute.my_attribute
14+
~ClassWithAttribute.my_property
15+
16+
.. rubric:: Methods Summary
17+
18+
.. autosummary::
19+
20+
~ClassWithAttribute.my_method
21+
22+
.. rubric:: Attributes Documentation
23+
24+
.. autoattribute:: my_attribute
25+
.. autoattribute:: my_property
26+
27+
.. rubric:: Methods Documentation
28+
29+
.. automethod:: my_method
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.attribute_class Module
3+
-------------------------------------------------------------
4+
5+
.. automodule:: sphinx_automodapi.tests.example_module.attribute_class
6+
7+
Classes
8+
^^^^^^^
9+
10+
.. automodsumm:: sphinx_automodapi.tests.example_module.attribute_class
11+
:classes-only:
12+
:toctree: api
13+
14+
Class Inheritance Diagram
15+
^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+
.. automod-diagram:: sphinx_automodapi.tests.example_module.attribute_class
18+
:private-bases:
19+
:parts: 1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. currentmodule:: sphinx_automodapi.tests.example_module.attribute_class
2+
3+
.. autosummary::
4+
:toctree: api
5+
6+
ClassWithAttribute
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ClassWithAttribute
2+
==================
3+
4+
.. currentmodule:: sphinx_automodapi.tests.example_module.attribute_class
5+
6+
.. autoclass:: ClassWithAttribute
7+
:show-inheritance:
8+
9+
.. rubric:: Attributes Summary
10+
11+
.. autosummary::
12+
13+
~ClassWithAttribute.my_attribute
14+
15+
~ClassWithAttribute.my_property
16+
17+
.. rubric:: Methods Summary
18+
19+
.. autosummary::
20+
21+
~ClassWithAttribute.my_method
22+
23+
.. rubric:: Attributes Documentation
24+
25+
.. autoattribute:: my_attribute
26+
27+
.. autoproperty:: my_property
28+
29+
.. rubric:: Methods Documentation
30+
31+
.. automethod:: my_method
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.attribute_class Module
3+
-------------------------------------------------------------
4+
5+
.. automodule:: sphinx_automodapi.tests.example_module.attribute_class
6+
7+
Classes
8+
^^^^^^^
9+
10+
.. automodsumm:: sphinx_automodapi.tests.example_module.attribute_class
11+
:classes-only:
12+
:toctree: api
13+
14+
Class Inheritance Diagram
15+
^^^^^^^^^^^^^^^^^^^^^^^^^
16+
17+
.. automod-diagram:: sphinx_automodapi.tests.example_module.attribute_class
18+
:private-bases:
19+
:parts: 1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. currentmodule:: sphinx_automodapi.tests.example_module.attribute_class
2+
3+
.. autosummary::
4+
:toctree: api
5+
6+
ClassWithAttribute
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class ClassWithAttribute(object):
2+
"""A class with an attribute."""
3+
my_attribute = 1
4+
5+
def my_method(self):
6+
"""A method."""
7+
pass
8+
9+
@property
10+
def my_property(self):
11+
"""A property."""
12+
return 1

0 commit comments

Comments
 (0)
0