@@ -288,6 +288,34 @@ def astype3(self, dtype):
288
288
"""
289
289
pass
290
290
291
+ def two_linebreaks_between_sections (self , foo ):
292
+ """
293
+ Test linebreaks message GL03.
294
+
295
+ Note 2 blank lines before parameters section.
296
+
297
+
298
+ Parameters
299
+ ----------
300
+ foo : str
301
+ Description of foo parameter.
302
+ """
303
+ pass
304
+
305
+ def linebreak_at_end_of_docstring (self , foo ):
306
+ """
307
+ Test linebreaks message GL03.
308
+
309
+ Note extra blank line at end of docstring.
310
+
311
+ Parameters
312
+ ----------
313
+ foo : str
314
+ Description of foo parameter.
315
+
316
+ """
317
+ pass
318
+
291
319
def plot (self , kind , ** kwargs ):
292
320
"""
293
321
Generate a plot.
@@ -723,7 +751,8 @@ def test_bad_class(self):
723
751
@capture_stderr
724
752
@pytest .mark .parametrize ("func" , [
725
753
'func' , 'astype' , 'astype1' , 'astype2' , 'astype3' , 'plot' , 'method' ,
726
- 'private_classes' ])
754
+ 'private_classes' ,
755
+ ])
727
756
def test_bad_generic_functions (self , func ):
728
757
errors = validate_one (self ._import_path ( # noqa:F821
729
758
klass = 'BadGenericDocStrings' , func = func ))['errors' ]
@@ -811,8 +840,16 @@ def test_bad_generic_functions(self, func):
811
840
'E226 missing whitespace around arithmetic operator' ,)),
812
841
('BadExamples' , 'missing_whitespace_after_comma' ,
813
842
("flake8 error: E231 missing whitespace after ',' (3 times)" ,)),
843
+ ('BadGenericDocStrings' , 'two_linebreaks_between_sections' ,
844
+ ('Double line break found; please use only one blank line to '
845
+ 'separate sections or paragraphs, and do not leave blank lines '
846
+ 'at the end of docstrings' ,)),
847
+ ('BadGenericDocStrings' , 'linebreak_at_end_of_docstring' ,
848
+ ('Double line break found; please use only one blank line to '
849
+ 'separate sections or paragraphs, and do not leave blank lines '
850
+ 'at the end of docstrings' ,)),
814
851
])
815
- def test_bad_examples (self , capsys , klass , func , msgs ):
852
+ def test_bad_docstrings (self , capsys , klass , func , msgs ):
816
853
result = validate_one (self ._import_path (klass = klass , func = func ))
817
854
for msg in msgs :
818
855
assert msg in ' ' .join (err [1 ] for err in result ['errors' ])
0 commit comments