mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Enable the RUF031 lint in Ruff
This commit is contained in:
@@ -414,7 +414,7 @@ def test_cmdoption(app):
|
||||
entries=[('pair', 'ls command line option; -l', 'cmdoption-ls-l', '', None)],
|
||||
)
|
||||
assert ('ls', '-l') in domain.progoptions
|
||||
assert domain.progoptions[('ls', '-l')] == ('index', 'cmdoption-ls-l')
|
||||
assert domain.progoptions['ls', '-l'] == ('index', 'cmdoption-ls-l')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
@@ -441,7 +441,7 @@ def test_cmdoption_for_None(app):
|
||||
entries=[('pair', 'command line option; -l', 'cmdoption-l', '', None)],
|
||||
)
|
||||
assert (None, '-l') in domain.progoptions
|
||||
assert domain.progoptions[(None, '-l')] == ('index', 'cmdoption-l')
|
||||
assert domain.progoptions[None, '-l'] == ('index', 'cmdoption-l')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='root')
|
||||
@@ -481,8 +481,8 @@ def test_multiple_cmdoptions(app):
|
||||
)
|
||||
assert ('cmd', '-o') in domain.progoptions
|
||||
assert ('cmd', '--output') in domain.progoptions
|
||||
assert domain.progoptions[('cmd', '-o')] == ('index', 'cmdoption-cmd-o')
|
||||
assert domain.progoptions[('cmd', '--output')] == ('index', 'cmdoption-cmd-o')
|
||||
assert domain.progoptions['cmd', '-o'] == ('index', 'cmdoption-cmd-o')
|
||||
assert domain.progoptions['cmd', '--output'] == ('index', 'cmdoption-cmd-o')
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='productionlist')
|
||||
|
||||
@@ -122,7 +122,7 @@ def test_skipif(app):
|
||||
|
||||
|
||||
def record(directive, part, should_skip):
|
||||
recorded_calls[(directive, part, should_skip)] += 1
|
||||
recorded_calls[directive, part, should_skip] += 1
|
||||
return f'Recorded {directive} {part} {should_skip}'
|
||||
|
||||
|
||||
|
||||
@@ -151,15 +151,15 @@ def test_ModuleAnalyzer_find_attr_docs():
|
||||
('Foo', 'attr8'),
|
||||
('Foo', 'attr9'),
|
||||
}
|
||||
assert docs[('Foo', 'attr1')] == ['comment before attr1', '']
|
||||
assert docs[('Foo', 'attr3')] == ['attribute comment for attr3', '']
|
||||
assert docs[('Foo', 'attr4')] == ['long attribute comment', '']
|
||||
assert docs[('Foo', 'attr4')] == ['long attribute comment', '']
|
||||
assert docs[('Foo', 'attr5')] == ['attribute comment for attr5', '']
|
||||
assert docs[('Foo', 'attr6')] == ['this comment is ignored', '']
|
||||
assert docs[('Foo', 'attr7')] == ['this comment is ignored', '']
|
||||
assert docs[('Foo', 'attr8')] == ['attribute comment for attr8', '']
|
||||
assert docs[('Foo', 'attr9')] == ['string after attr9', '']
|
||||
assert docs['Foo', 'attr1'] == ['comment before attr1', '']
|
||||
assert docs['Foo', 'attr3'] == ['attribute comment for attr3', '']
|
||||
assert docs['Foo', 'attr4'] == ['long attribute comment', '']
|
||||
assert docs['Foo', 'attr4'] == ['long attribute comment', '']
|
||||
assert docs['Foo', 'attr5'] == ['attribute comment for attr5', '']
|
||||
assert docs['Foo', 'attr6'] == ['this comment is ignored', '']
|
||||
assert docs['Foo', 'attr7'] == ['this comment is ignored', '']
|
||||
assert docs['Foo', 'attr8'] == ['attribute comment for attr8', '']
|
||||
assert docs['Foo', 'attr9'] == ['string after attr9', '']
|
||||
assert analyzer.tagorder == {
|
||||
'Foo': 0,
|
||||
'Foo.__init__': 8,
|
||||
@@ -189,5 +189,5 @@ def test_ModuleAnalyzer_find_attr_docs_for_posonlyargs_method():
|
||||
analyzer = ModuleAnalyzer.for_string(code, 'module')
|
||||
docs = analyzer.find_attr_docs()
|
||||
assert set(docs) == {('Foo', 'attr')}
|
||||
assert docs[('Foo', 'attr')] == ['attribute comment', '']
|
||||
assert docs['Foo', 'attr'] == ['attribute comment', '']
|
||||
assert analyzer.tagorder == {'Foo': 0, 'Foo.__init__': 1, 'Foo.attr': 2}
|
||||
|
||||
Reference in New Issue
Block a user