| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
def func_with_docstring(): |
| 5 |
"""Some unrelated info.""" |
| 6 |
|
| 7 |
|
| 8 |
def func_without_docstring(): |
| 9 |
pass |
| 10 |
|
| 11 |
|
| 12 |
def func_with_doctest(): |
| 13 |
""" |
| 14 |
This function really contains a test case. |
| 15 |
|
| 16 |
>>> func_with_doctest.__name__ |
| 17 |
'func_with_doctest' |
| 18 |
""" |
| 19 |
return 3 |
| 20 |
|
| 21 |
|
| 22 |
class ClassWithDocstring: |
| 23 |
"""Some unrelated class information.""" |
| 24 |
|
| 25 |
|
| 26 |
class ClassWithoutDocstring: |
| 27 |
pass |
| 28 |
|
| 29 |
|
| 30 |
class ClassWithDoctest: |
| 31 |
"""This class really has a test case in it. |
| 32 |
|
| 33 |
>>> ClassWithDoctest.__name__ |
| 34 |
'ClassWithDoctest' |
| 35 |
""" |
| 36 |
|
| 37 |
|
| 38 |
class MethodWrapper: |
| 39 |
def method_with_docstring(self): |
| 40 |
"""Method with a docstring.""" |
| 41 |
|
| 42 |
def method_without_docstring(self): |
| 43 |
pass |
| 44 |
|
| 45 |
def method_with_doctest(self): |
| 46 |
""" |
| 47 |
This has a doctest! |
| 48 |
>>> MethodWrapper.method_with_doctest.__name__ |
| 49 |
'method_with_doctest' |
| 50 |
""" |
| 51 |
|
| 52 |
@classmethod |
| 53 |
def classmethod_with_doctest(cls): |
| 54 |
""" |
| 55 |
This has a doctest! |
| 56 |
>>> MethodWrapper.classmethod_with_doctest.__name__ |
| 57 |
'classmethod_with_doctest' |
| 58 |
""" |
| 59 |
|
| 60 |
@property |
| 61 |
def property_with_doctest(self): |
| 62 |
""" |
| 63 |
This has a doctest! |
| 64 |
>>> MethodWrapper.property_with_doctest.__name__ |
| 65 |
'property_with_doctest' |
| 66 |
""" |
| 67 |
|
| 68 |
|
| 69 |
str_wrapper = object().__str__ |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
from test.test_doctest.decorator_mod import decorator |
| 74 |
|
| 75 |
@decorator |
| 76 |
@decorator |
| 77 |
def func_with_docstring_wrapped(): |
| 78 |
"""Some unrelated info.""" |