@@ -184,146 +184,6 @@ def do_something(): #@
184
184
with self .assertNoMessages ():
185
185
self .checker .visit_functiondef (node )
186
186
187
- def test_finds_missing_raises_from_setter_numpy_2 (self ) -> None :
188
- """Example of a setter having missing raises documentation in
189
- its own Numpy style docstring of the property
190
- """
191
- setter_node , node = astroid .extract_node (
192
- """
193
- class Foo(object):
194
- @property
195
- def foo(self):
196
- '''int: docstring ...
197
-
198
- Raises
199
- ------
200
- RuntimeError
201
- Always
202
- '''
203
- raise RuntimeError()
204
- return 10
205
-
206
- @foo.setter
207
- def foo(self, value): #@
208
- '''setter docstring ...
209
-
210
- Raises
211
- ------
212
- RuntimeError
213
- Never
214
- '''
215
- if True:
216
- raise AttributeError() #@
217
- raise RuntimeError()
218
- """
219
- )
220
- with self .assertAddsMessages (
221
- MessageTest (
222
- msg_id = "missing-raises-doc" , node = setter_node , args = ("AttributeError" ,)
223
- )
224
- ):
225
- self .checker .visit_raise (node )
226
-
227
- def test_finds_property_return_type_numpy (self ) -> None :
228
- """Example of a property having return documentation in
229
- a numpy style docstring
230
- """
231
- node = astroid .extract_node (
232
- """
233
- class Foo(object):
234
- @property
235
- def foo(self): #@
236
- '''int: docstring ...
237
-
238
- Raises
239
- ------
240
- RuntimeError
241
- Always
242
- '''
243
- raise RuntimeError()
244
- return 10
245
- """
246
- )
247
- with self .assertNoMessages ():
248
- self .checker .visit_functiondef (node )
249
-
250
- @set_config (accept_no_return_doc = "no" )
251
- def test_finds_missing_property_return_type_numpy (self ) -> None :
252
- """Example of a property having return documentation in
253
- a numpy style docstring
254
- """
255
- property_node , node = astroid .extract_node (
256
- """
257
- class Foo(object):
258
- @property
259
- def foo(self): #@
260
- '''docstring ...
261
-
262
- Raises
263
- ------
264
- RuntimeError
265
- Always
266
- '''
267
- raise RuntimeError()
268
- return 10 #@
269
- """
270
- )
271
- with self .assertAddsMessages (
272
- MessageTest (msg_id = "missing-return-type-doc" , node = property_node )
273
- ):
274
- self .checker .visit_return (node )
275
-
276
- @set_config (accept_no_return_doc = "no" )
277
- def test_ignores_non_property_return_type_numpy (self ) -> None :
278
- """Example of a class function trying to use `type` as return
279
- documentation in a numpy style docstring
280
- """
281
- func_node , node = astroid .extract_node (
282
- """
283
- class Foo(object):
284
- def foo(self): #@
285
- '''int: docstring ...
286
-
287
- Raises
288
- ------
289
- RuntimeError
290
- Always
291
- '''
292
- raise RuntimeError()
293
- return 10 #@
294
- """
295
- )
296
- with self .assertAddsMessages (
297
- MessageTest (msg_id = "missing-return-doc" , node = func_node ),
298
- MessageTest (msg_id = "missing-return-type-doc" , node = func_node ),
299
- ):
300
- self .checker .visit_return (node )
301
-
302
- @set_config (accept_no_return_doc = "no" )
303
- def test_non_property_annotation_return_type_numpy (self ) -> None :
304
- """Example of a class function trying to use `type` as return
305
- documentation in a numpy style docstring
306
- """
307
- func_node , node = astroid .extract_node (
308
- """
309
- class Foo(object):
310
- def foo(self) -> int: #@
311
- '''int: docstring ...
312
-
313
- Raises
314
- ------
315
- RuntimeError
316
- Always
317
- '''
318
- raise RuntimeError()
319
- return 10 #@
320
- """
321
- )
322
- with self .assertAddsMessages (
323
- MessageTest (msg_id = "missing-return-doc" , node = func_node )
324
- ):
325
- self .checker .visit_return (node )
326
-
327
187
@set_config_directly (no_docstring_rgx = re .compile (r"^_(?!_).*$" ))
328
188
def test_skip_no_docstring_rgx (self ) -> None :
329
189
"""Example of a function that matches the default 'no-docstring-rgx' config option
0 commit comments