| 1 |
""" |
| 2 |
Module for testing the autodocsumm |
| 3 |
|
| 4 |
Just a dummy module with some class definitions |
| 5 |
""" |
| 6 |
|
| 7 |
|
| 8 |
#: to test if the data is included |
| 9 |
test_data = None |
| 10 |
|
| 11 |
|
| 12 |
def test_func(): |
| 13 |
"""Test if function is contained in autosummary""" |
| 14 |
pass |
| 15 |
|
| 16 |
|
| 17 |
class Class_CallTest(object): |
| 18 |
"""A class defining a __call__ method""" |
| 19 |
|
| 20 |
def __get__(self, instance, owner): |
| 21 |
return self |
| 22 |
|
| 23 |
def __set__(self, instance, value): |
| 24 |
"""Actually not required. We just implement it to ensure the python |
| 25 |
"help" function works well""" |
| 26 |
pass |
| 27 |
|
| 28 |
def __call__(self, a, b): |
| 29 |
""" |
| 30 |
Caller docstring for class attribute |
| 31 |
|
| 32 |
Parameters |
| 33 |
---------- |
| 34 |
a: any |
| 35 |
dummy parameter |
| 36 |
b: anything else |
| 37 |
second dummy parameter""" |
| 38 |
pass |
| 39 |
|
| 40 |
|
| 41 |
class TestClass(object): |
| 42 |
"""Class test for autosummary""" |
| 43 |
|
| 44 |
def __init__(self): |
| 45 |
#: This is an instance attribute |
| 46 |
self.instance_attribute = 1 |
| 47 |
|
| 48 |
def test_method(self): |
| 49 |
"""Test if the method is included""" |
| 50 |
pass |
| 51 |
|
| 52 |
def test_method_args_kwargs(self, *args, **kwargs): |
| 53 |
"""The stars at args and kwargs should not be escaped""" |
| 54 |
|
| 55 |
class InnerClass(object): |
| 56 |
"""A test for an inner class""" |
| 57 |
|
| 58 |
#: to test if the class attribute is included |
| 59 |
test_attr = None |
| 60 |
|
| 61 |
class_caller = Class_CallTest() |
| 62 |
|
| 63 |
#: data to be included |
| 64 |
large_data = 'Should be included' |
| 65 |
|
| 66 |
#: data to be skipped |
| 67 |
small_data = 'Should be skipped' |
| 68 |
|
| 69 |
|
| 70 |
class TestException(Exception): |
| 71 |
"""Exception test for autosummary""" |
| 72 |
|
| 73 |
def __init__(self): |
| 74 |
#: This is an exception attribute |
| 75 |
self.exception_instance_attribute = 1 |
| 76 |
|
| 77 |
def test_exception_method(self): |
| 78 |
"""Test if the method is included""" |
| 79 |
pass |
| 80 |
|
| 81 |
|
| 82 |
class InheritedTestClass(TestClass): |
| 83 |
"""Class test for inherited attributes""" |
| 84 |
|
| 85 |
|
| 86 |
class TestClassWithInlineAutoClassSumm: |
| 87 |
"""Class test for the autodocsummary inline |
| 88 |
|
| 89 |
.. autoclasssumm:: TestClassWithInlineAutoClassSumm |
| 90 |
|
| 91 |
This is after the summary. |
| 92 |
""" |
| 93 |
|
| 94 |
def test_method_of_inline_test(self): |
| 95 |
"""A test method.""" |
| 96 |
pass |
| 97 |
|
| 98 |
|
| 99 |
class TestClassWithRefToOtherClass: |
| 100 |
"""Class test for the autodocsummary when a class attribute is a reference |
| 101 |
to another class. No autosummary of the class should be generated for |
| 102 |
the attribute. See also issue #69""" |
| 103 |
|
| 104 |
foo = TestClass |
| 105 |
|
| 106 |
|
| 107 |
#: data to be skipped |
| 108 |
large_data = 'Should also be skipped' |
| 109 |
|
| 110 |
#: data to be included |
| 111 |
small_data = 'Should also be included' |