-
-
Notifications
You must be signed in to change notification settings - Fork 170
Closed
Description
Testing downstream in Gentoo for python 3.12 compatibility, one test fails for me:
======================================================================= FAILURES =======================================================================
______________________________________ TestValidator.test_bad_docstrings[BadReturns-return_not_documented-msgs31] ______________________________________
self = <test_validate.TestValidator object at 0x7fc36ada6d20>, capsys = <_pytest.capture.CaptureFixture object at 0x7fc36978e0f0>, klass = 'BadReturns'
func = 'return_not_documented', msgs = ('No Returns section found',)
@pytest.mark.parametrize(
"klass,func,msgs",
[
# See Also tests
(
"BadGenericDocStrings",
"unknown_section",
('Found unknown section "Unknown Section".',),
),
(
"BadGenericDocStrings",
"sections_in_wrong_order",
(
"Sections are in the wrong order. Correct order is: Parameters, "
"See Also, Examples",
),
),
(
"BadGenericDocStrings",
"deprecation_in_wrong_order",
("Deprecation warning should precede extended summary",),
),
(
"BadGenericDocStrings",
"directives_without_two_colons",
(
"reST directives ['versionchanged', 'versionadded', "
"'deprecated'] must be followed by two colons",
),
),
(
"BadSeeAlso",
"no_desc",
('Missing description for See Also "Series.tail" reference',),
),
(
"BadSeeAlso",
"desc_no_period",
('Missing period at end of description for See Also "Series.iloc"',),
),
(
"BadSeeAlso",
"desc_first_letter_lowercase",
('should be capitalized for See Also "Series.tail"',),
),
# Summary tests
(
"BadSummaries",
"no_summary",
("No summary found",),
),
(
"BadSummaries",
"heading_whitespaces",
("Summary contains heading whitespaces",),
),
(
"BadSummaries",
"wrong_line",
(
"should start in the line immediately after the opening quotes",
"should be placed in the line after the last text",
),
),
("BadSummaries", "no_punctuation", ("Summary does not end with a period",)),
(
"BadSummaries",
"no_capitalization",
("Summary does not start with a capital letter",),
),
(
"BadSummaries",
"no_capitalization",
("Summary must start with infinitive verb",),
),
("BadSummaries", "multi_line", ("Summary should fit in a single line",)),
(
"BadSummaries",
"two_paragraph_multi_line",
("Summary should fit in a single line",),
),
# Parameters tests
(
"BadParameters",
"no_type",
('Parameter "value" has no type',),
),
(
"BadParameters",
"type_with_period",
('Parameter "value" type should not finish with "."',),
),
(
"BadParameters",
"no_description",
('Parameter "value" has no description',),
),
(
"BadParameters",
"missing_params",
("Parameters {'**kwargs'} not documented",),
),
(
"BadParameters",
"bad_colon_spacing",
(
'Parameter "kind" requires a space before the colon '
"separating the parameter name and type",
),
),
(
"BadParameters",
"no_description_period",
('Parameter "kind" description should finish with "."',),
),
(
"BadParameters",
"no_description_period_with_directive",
('Parameter "kind" description should finish with "."',),
),
(
"BadParameters",
"parameter_capitalization",
('Parameter "kind" description should start with a capital letter',),
),
(
"BadParameters",
"integer_parameter",
('Parameter "kind" type should use "int" instead of "integer"',),
),
(
"BadParameters",
"string_parameter",
('Parameter "kind" type should use "str" instead of "string"',),
),
(
"BadParameters",
"boolean_parameter",
('Parameter "kind" type should use "bool" instead of "boolean"',),
),
(
"BadParameters",
"list_incorrect_parameter_type",
('Parameter "kind" type should use "bool" instead of "boolean"',),
),
(
"BadParameters",
"list_incorrect_parameter_type",
('Parameter "kind" type should use "int" instead of "integer"',),
),
(
"BadParameters",
"list_incorrect_parameter_type",
('Parameter "kind" type should use "str" instead of "string"',),
),
(
"BadParameters",
"bad_parameter_spacing",
("Parameters {'b'} not documented", "Unknown parameters {' b'}"),
),
pytest.param(
"BadParameters",
"blank_lines",
("No error yet?",),
marks=pytest.mark.xfail,
),
# Returns tests
("BadReturns", "return_not_documented", ("No Returns section found",)),
("BadReturns", "yield_not_documented", ("No Yields section found",)),
pytest.param("BadReturns", "no_type", ("foo",), marks=pytest.mark.xfail),
("BadReturns", "no_description", ("Return value has no description",)),
(
"BadReturns",
"no_punctuation",
('Return value description should finish with "."',),
),
(
"BadReturns",
"named_single_return",
(
"The first line of the Returns section should contain only the "
"type, unless multiple values are being returned",
),
),
(
"BadReturns",
"no_capitalization",
("Return value description should start with a capital letter",),
),
(
"BadReturns",
"no_period_multi",
('Return value description should finish with "."',),
),
(
"BadGenericDocStrings",
"method_wo_docstrings",
("The object does not have a docstring",),
),
(
"BadGenericDocStrings",
"two_linebreaks_between_sections",
(
"Double line break found; please use only one blank line to "
"separate sections or paragraphs, and do not leave blank lines "
"at the end of docstrings",
),
),
(
"BadGenericDocStrings",
"linebreak_at_end_of_docstring",
(
"Double line break found; please use only one blank line to "
"separate sections or paragraphs, and do not leave blank lines "
"at the end of docstrings",
),
),
],
)
def test_bad_docstrings(self, capsys, klass, func, msgs):
with warnings.catch_warnings(record=True) as w:
result = validate_one(self._import_path(klass=klass, func=func))
if len(w):
> assert all("Unknown section" in str(ww.message) for ww in w)
E assert False
E + where False = all(<generator object TestValidator.test_bad_docstrings.<locals>.<genexpr> at 0x7fc3694ec820>)
capsys = <_pytest.capture.CaptureFixture object at 0x7fc36978e0f0>
func = 'return_not_documented'
klass = 'BadReturns'
msgs = ('No Returns section found',)
result = {'deprecated': False,
'docstring': 'Lacks section for Returns',
'errors': [('SS03', 'Summary does not end with a period'),
('SS05',
'Summary must start with infinitive verb, not third person (e.g. '
'use "Generate" instead of "Generates")'),
('ES01', 'No extended summary found'),
('RT01', 'No Returns section found'),
('SA01', 'See Also section not found'),
('EX01', 'No examples section found')],
'file': '/tmp/portage/dev-python/numpydoc-1.6.0/work/numpydoc-1.6.0/numpydoc/tests/test_validate.py',
'file_line': 1038,
'type': 'function'}
self = <test_validate.TestValidator object at 0x7fc36ada6d20>
w = [<warnings.WarningMessage object at 0x7fc36978dc40>]
numpydoc/tests/test_validate.py:1529: AssertionError
=================================================================== warnings summary ===================================================================
numpydoc/tests/test_validate.py::TestValidator::test_good_functions[empty_returns]
numpydoc/tests/test_validate.py::TestValidator::test_bad_generic_functions[func]
/tmp/portage/dev-python/numpydoc-1.6.0/work/numpydoc-1.6.0/numpydoc/validate.py:525: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
if isinstance(v, ast.NameConstant) and v.value is None:
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================================================== short test summary info ================================================================
XFAIL numpydoc/tests/test_validate.py::TestValidator::test_bad_docstrings[BadParameters-blank_lines-msgs30]
XFAIL numpydoc/tests/test_validate.py::TestValidator::test_bad_docstrings[BadReturns-no_type-msgs33]
FAILED numpydoc/tests/test_validate.py::TestValidator::test_bad_docstrings[BadReturns-return_not_documented-msgs31] - assert False
========================================== 1 failed, 254 passed, 2 deselected, 2 xfailed, 2 warnings in 1.39s ==========================================
This is reproducible with the latest code from the main branch.
Metadata
Metadata
Assignees
Labels
No labels