@@ 124-152 (lines=29) @@ | ||
121 | self.ReturnValue(desc=' something2 ')] |
|
122 | self.check_docstring(doc, expected) |
|
123 | ||
124 | def test_python_default(self): |
|
125 | data = load_testdata("default.py") |
|
126 | ||
127 | parsed_docs = [doc.parse() for doc in |
|
128 | extract_documentation(data, "python", "default")] |
|
129 | ||
130 | expected = [ |
|
131 | [self.Description(desc='\nModule description.\n\n' |
|
132 | 'Some more foobar-like text.\n')], |
|
133 | [self.Description(desc='\nA nice and neat way of ' |
|
134 | 'documenting code.\n'), |
|
135 | self.Parameter(name='radius', desc=' The explosion radius. ')], |
|
136 | [self.Description(desc='A function that returns 55.')], |
|
137 | [self.Description(desc='\nDocstring with layouted text.\n\n ' |
|
138 | 'layouts inside docs are preserved.' |
|
139 | '\nthis is intended.\n')], |
|
140 | [self.Description(desc=' Docstring inline with triple quotes.\n' |
|
141 | ' Continues here. ')], |
|
142 | [self.Description(desc='\nThis is the best docstring ever!\n\n'), |
|
143 | self.Parameter(name='param1', |
|
144 | desc='\n Very Very Long Parameter ' |
|
145 | 'description.\n'), |
|
146 | self.Parameter(name='param2', |
|
147 | desc='\n Short Param description.\n\n'), |
|
148 | self.ReturnValue(desc=' Long Return Description That Makes No ' |
|
149 | 'Sense And Will\n Cut to the Next' |
|
150 | ' Line.\n')]] |
|
151 | ||
152 | self.assertEqual(parsed_docs, expected) |
|
153 | ||
154 | def test_python_doxygen(self): |
|
155 | data = load_testdata("doxygen.py") |
|
@@ 154-175 (lines=22) @@ | ||
151 | ||
152 | self.assertEqual(parsed_docs, expected) |
|
153 | ||
154 | def test_python_doxygen(self): |
|
155 | data = load_testdata("doxygen.py") |
|
156 | ||
157 | parsed_docs = [doc.parse() for doc in |
|
158 | extract_documentation(data, "python", "doxygen")] |
|
159 | ||
160 | expected = [ |
|
161 | [self.Description(desc=' @package pyexample\n Documentation for' |
|
162 | ' this module.\n\n More details.\n')], |
|
163 | [self.Description( |
|
164 | desc=' Documentation for a class.\n\n More details.\n')], |
|
165 | [self.Description(desc=' The constructor.\n')], |
|
166 | [self.Description(desc=' Documentation for a method.\n'), |
|
167 | self.Parameter(name='self', desc='The object pointer.\n')], |
|
168 | [self.Description(desc=' A class variable.\n')], |
|
169 | [self.Description(desc=' @var _memVar\n a member variable\n')], |
|
170 | [self.Description(desc=' This is the best docstring ever!\n\n'), |
|
171 | self.Parameter(name='param1', desc='Parameter 1\n'), |
|
172 | self.Parameter(name='param2', desc='Parameter 2\n'), |
|
173 | self.ReturnValue(desc='Nothing\n')]] |
|
174 | ||
175 | self.assertEqual(parsed_docs, expected) |
|
176 | ||
177 | ||
178 | class JavaDocumentationCommentTest(DocumentationCommentTest): |