@@ -288,6 +288,34 @@ def astype3(self, dtype):
288288 """
289289 pass
290290
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+
291319 def plot (self , kind , ** kwargs ):
292320 """
293321 Generate a plot.
@@ -723,7 +751,8 @@ def test_bad_class(self):
723751 @capture_stderr
724752 @pytest .mark .parametrize ("func" , [
725753 'func' , 'astype' , 'astype1' , 'astype2' , 'astype3' , 'plot' , 'method' ,
726- 'private_classes' ])
754+ 'private_classes' ,
755+ ])
727756 def test_bad_generic_functions (self , func ):
728757 errors = validate_one (self ._import_path ( # noqa:F821
729758 klass = 'BadGenericDocStrings' , func = func ))['errors' ]
@@ -811,8 +840,16 @@ def test_bad_generic_functions(self, func):
811840 'E226 missing whitespace around arithmetic operator' ,)),
812841 ('BadExamples' , 'missing_whitespace_after_comma' ,
813842 ("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' ,)),
814851 ])
815- def test_bad_examples (self , capsys , klass , func , msgs ):
852+ def test_bad_docstrings (self , capsys , klass , func , msgs ):
816853 result = validate_one (self ._import_path (klass = klass , func = func ))
817854 for msg in msgs :
818855 assert msg in ' ' .join (err [1 ] for err in result ['errors' ])
0 commit comments