mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Bump Ruff to 0.7.2
This commit is contained in:
@@ -372,9 +372,9 @@ def test_toc_all_references_should_exist_pep420_enabled(apidoc):
|
||||
missing_files.append(filename)
|
||||
|
||||
all_missing = ', '.join(missing_files)
|
||||
assert (
|
||||
len(missing_files) == 0
|
||||
), f'File(s) referenced in TOC not found: {all_missing}\nTOC:\n{toc}'
|
||||
assert len(missing_files) == 0, (
|
||||
f'File(s) referenced in TOC not found: {all_missing}\nTOC:\n{toc}'
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.apidoc(
|
||||
@@ -403,9 +403,9 @@ def test_toc_all_references_should_exist_pep420_disabled(apidoc):
|
||||
missing_files.append(filename)
|
||||
|
||||
all_missing = ', '.join(missing_files)
|
||||
assert (
|
||||
len(missing_files) == 0
|
||||
), f'File(s) referenced in TOC not found: {all_missing}\nTOC:\n{toc}'
|
||||
assert len(missing_files) == 0, (
|
||||
f'File(s) referenced in TOC not found: {all_missing}\nTOC:\n{toc}'
|
||||
)
|
||||
|
||||
|
||||
def extract_toc(path):
|
||||
|
@@ -1558,9 +1558,9 @@ class _EnumFormatter:
|
||||
def preamble_lookup(
|
||||
self, doc: str, *, indent: int = 0, **options: Any
|
||||
) -> list[str]:
|
||||
assert (
|
||||
doc
|
||||
), f'enumeration class {self.target!r} should have an explicit docstring'
|
||||
assert doc, (
|
||||
f'enumeration class {self.target!r} should have an explicit docstring'
|
||||
)
|
||||
|
||||
args = self._preamble_args(functional_constructor=False)
|
||||
return self._preamble(doc=doc, args=args, indent=indent, **options)
|
||||
@@ -1568,9 +1568,9 @@ class _EnumFormatter:
|
||||
def preamble_constructor(
|
||||
self, doc: str, *, indent: int = 0, **options: Any
|
||||
) -> list[str]:
|
||||
assert (
|
||||
doc
|
||||
), f'enumeration class {self.target!r} should have an explicit docstring'
|
||||
assert doc, (
|
||||
f'enumeration class {self.target!r} should have an explicit docstring'
|
||||
)
|
||||
|
||||
args = self._preamble_args(functional_constructor=True)
|
||||
return self._preamble(doc=doc, args=args, indent=indent, **options)
|
||||
|
@@ -192,9 +192,9 @@ def test_get_items_summary(make_app, app_params):
|
||||
'C.C2': 'This is a nested inner class docstring',
|
||||
}
|
||||
for key, expected in expected_values.items():
|
||||
assert (
|
||||
autosummary_items[key][2] == expected
|
||||
), f'Summary for {key} was {autosummary_items[key]!r} - expected {expected!r}'
|
||||
assert autosummary_items[key][2] == expected, (
|
||||
f'Summary for {key} was {autosummary_items[key]!r} - expected {expected!r}'
|
||||
)
|
||||
|
||||
# check an item in detail
|
||||
assert 'func' in autosummary_items
|
||||
@@ -566,11 +566,7 @@ def test_autosummary_generate(app):
|
||||
Foo = path.read_text(encoding='utf8')
|
||||
assert '.. automethod:: __init__' in Foo
|
||||
assert (
|
||||
' .. autosummary::\n'
|
||||
' \n'
|
||||
' ~Foo.__init__\n'
|
||||
' ~Foo.bar\n'
|
||||
' \n'
|
||||
' .. autosummary::\n \n ~Foo.__init__\n ~Foo.bar\n \n'
|
||||
) in Foo
|
||||
assert (
|
||||
' .. autosummary::\n'
|
||||
@@ -591,9 +587,7 @@ def test_autosummary_generate(app):
|
||||
path = app.srcdir / 'generated' / 'autosummary_dummy_module.Foo.value.rst'
|
||||
Foo_value = path.read_text(encoding='utf8')
|
||||
assert (
|
||||
'.. currentmodule:: autosummary_dummy_module\n'
|
||||
'\n'
|
||||
'.. autoattribute:: Foo.value'
|
||||
'.. currentmodule:: autosummary_dummy_module\n\n.. autoattribute:: Foo.value'
|
||||
) in Foo_value
|
||||
|
||||
path = app.srcdir / 'generated' / 'autosummary_dummy_module.qux.rst'
|
||||
@@ -820,17 +814,10 @@ def test_autosummary_module_all(app):
|
||||
).read_text(encoding='utf8')
|
||||
assert ' .. autosummary::\n \n PublicBar\n \n' in module
|
||||
assert (
|
||||
' .. autosummary::\n'
|
||||
' \n'
|
||||
' public_foo\n'
|
||||
' public_baz\n'
|
||||
' \n'
|
||||
' .. autosummary::\n \n public_foo\n public_baz\n \n'
|
||||
) in module
|
||||
assert (
|
||||
'.. autosummary::\n'
|
||||
' :toctree:\n'
|
||||
' :recursive:\n\n'
|
||||
' extra_dummy_module\n'
|
||||
'.. autosummary::\n :toctree:\n :recursive:\n\n extra_dummy_module\n'
|
||||
) in module
|
||||
finally:
|
||||
sys.modules.pop('autosummary_dummy_package_all', None)
|
||||
|
@@ -168,12 +168,7 @@ def test_graphviz_parse_mapfile():
|
||||
assert cmap.generate_clickable_map() == ''
|
||||
|
||||
# normal graph
|
||||
code = (
|
||||
'digraph {\n'
|
||||
' foo [href="https://www.google.com/"];\n'
|
||||
' foo -> bar;\n'
|
||||
'}\n'
|
||||
)
|
||||
code = 'digraph {\n foo [href="https://www.google.com/"];\n foo -> bar;\n}\n'
|
||||
content = (
|
||||
'<map id="%3" name="%3">\n'
|
||||
'<area shape="poly" id="node1" href="https://www.google.com/" title="foo" alt=""'
|
||||
|
@@ -443,9 +443,7 @@ class TestGoogleDocstring:
|
||||
assert str(actual) == expect
|
||||
|
||||
# Single line
|
||||
actual = GoogleDocstring(
|
||||
f'{section}:\n' ' this is a single line\n', config
|
||||
)
|
||||
actual = GoogleDocstring(f'{section}:\n this is a single line\n', config)
|
||||
expect = f'.. {admonition}:: this is a single line\n'
|
||||
assert str(actual) == expect
|
||||
|
||||
@@ -1599,7 +1597,7 @@ class TestNumpyDocstring:
|
||||
|
||||
# Single line
|
||||
actual = NumpyDocstring(
|
||||
f"{section}\n{'-' * len(section)}\n this is a single line\n",
|
||||
f'{section}\n{"-" * len(section)}\n this is a single line\n',
|
||||
config,
|
||||
)
|
||||
expect = f'.. {admonition}:: this is a single line\n'
|
||||
|
Reference in New Issue
Block a user