Fix flake8 violations

This commit is contained in:
Takeshi KOMIYA 2017-12-23 21:20:32 +09:00
parent 2e04c2a058
commit a9efb2517a
18 changed files with 247 additions and 247 deletions

View File

@ -425,7 +425,7 @@ def test_get_doc():
# class has __init__ method without docstring and
# __new__ method with docstring
# class docstring: depends on config value which one is taken
class I:
class I: # NOQA
"""Class docstring"""
def __new__(cls):
"""New docstring"""

View File

@ -34,8 +34,8 @@ def nonascii_srcdir(request, rootdir, sphinx_test_tempdir):
basedir = sphinx_test_tempdir / request.node.originalname
# Windows with versions prior to 3.2 (I think) doesn't support unicode on system path
# so we force a non-unicode path in that case
if sys.platform == "win32" and \
not (sys.version_info.major >= 3 and sys.version_info.minor >= 2):
if (sys.platform == "win32" and
not (sys.version_info.major >= 3 and sys.version_info.minor >= 2)):
return basedir / 'all'
try:
srcdir = basedir / test_name

View File

@ -245,5 +245,3 @@ def test_epub_writing_mode(app):
# vertical / writing-mode (CSS)
css = (app.outdir / '_static' / 'epub.css').text()
assert 'writing-mode: vertical-rl;' in css

View File

@ -15,7 +15,6 @@ from itertools import cycle, chain
from six import PY3
from sphinx import __display_version__
from sphinx.util.inventory import InventoryFile
from sphinx.testing.util import remove_unicode_literals, strip_escseq
import xml.etree.cElementTree as ElementTree

View File

@ -773,6 +773,7 @@ def test_toctree_maxdepth_manual(app, status, warning):
assert '\\setcounter{secnumdepth}' not in result
assert '\\chapter{Foo}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_documents': [
@ -789,6 +790,7 @@ def test_toctree_maxdepth_howto(app, status, warning):
assert '\\setcounter{secnumdepth}' not in result
assert '\\section{Foo}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'master_doc': 'foo'})
@ -802,6 +804,7 @@ def test_toctree_not_found(app, status, warning):
assert '\\setcounter{secnumdepth}' not in result
assert '\\chapter{Foo A}' in result
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'master_doc': 'bar'})

View File

@ -72,7 +72,7 @@ def test_texinfo(app, status, warning):
@pytest.mark.sphinx('html', testroot='docutilsconf',
docutilsconf='[general]\nsource_link=true\n')
@pytest.mark.skip(sys.platform == "win32" and \
@pytest.mark.skip(sys.platform == "win32" and
not (sys.version_info.major >= 3 and sys.version_info.minor >= 2),
reason="Python < 3.2 on Win32 doesn't handle non-ASCII paths right")
def test_docutils_source_link_with_nonascii_file(app, status, warning):

View File

@ -118,9 +118,9 @@ def test_expressions():
for i in ints:
for u in unsignedSuffix:
for l in longSuffix:
expr = i + u + l;
expr = i + u + l
exprCheck(expr, 'L' + expr + 'E')
expr = i + l + u;
expr = i + l + u
exprCheck(expr, 'L' + expr + 'E')
for suffix in ['', 'f', 'F', 'l', 'L']:
expr = '5.0' + suffix
@ -472,7 +472,8 @@ def test_class_definitions():
# from #4094
check('class', 'template<class, class = std::void_t<>> has_var', {2: 'I00E7has_var'})
check('class', 'template<class T> has_var<T, std::void_t<decltype(&T::var)>>', {2:'I0E7has_varI1TNSt6void_tIDTadN1T3varEEEEE'})
check('class', 'template<class T> has_var<T, std::void_t<decltype(&T::var)>>',
{2: 'I0E7has_varI1TNSt6void_tIDTadN1T3varEEEEE'})
def test_enum_definitions():
@ -587,7 +588,6 @@ def test_template_args():
{2: "I0E21enable_if_not_array_t"})
def test_attributes():
# style: C++
check('member', '[[]] int f', {1: 'f__i', 2: '1f'})

View File

@ -163,7 +163,8 @@ def test_import_by_name():
assert parent is sphinx.ext.autosummary
assert modname == 'sphinx.ext.autosummary'
prefixed_name, obj, parent, modname = import_by_name('sphinx.ext.autosummary.Autosummary.get_items')
prefixed_name, obj, parent, modname = \
import_by_name('sphinx.ext.autosummary.Autosummary.get_items')
assert prefixed_name == 'sphinx.ext.autosummary.Autosummary.get_items'
assert obj == sphinx.ext.autosummary.Autosummary.get_items
assert parent is sphinx.ext.autosummary.Autosummary

View File

@ -40,6 +40,7 @@ def test_graphviz_png_html(app, status, warning):
r'}\" />\n</div>')
assert re.search(html, content, re.S)
@pytest.mark.sphinx('html', testroot='ext-graphviz',
confoverrides={'graphviz_output_format': 'svg'})
@pytest.mark.usefixtures('if_graphviz_found')
@ -80,6 +81,7 @@ def test_graphviz_svg_html(app, status, warning):
r'</div>')
assert re.search(html, content, re.S)
@pytest.mark.sphinx('latex', testroot='ext-graphviz')
@pytest.mark.usefixtures('if_graphviz_found')
def test_graphviz_latex(app, status, warning):

View File

@ -240,7 +240,6 @@ def test_missing_reference_cppdomain(tempdir, app, status, warning):
' title="(in foo v2.0)">bartype</a>' in html)
def test_missing_reference_jsdomain(tempdir, app, status, warning):
inv_file = tempdir / 'inventory'
inv_file.write_bytes(inventory_v2)

View File

@ -85,6 +85,7 @@ def test_todo_not_included(app, status, warning):
assert len(todos) == 2
assert set(todo[1].astext() for todo in todos) == set(['todo in foo', 'todo in bar'])
@pytest.mark.sphinx('latex', testroot='ext-todo', freshenv=True,
confoverrides={'todo_include_todos': True, 'todo_emit_warnings': True})
def test_todo_valid_link(app, status, warning):
@ -107,8 +108,7 @@ def test_todo_valid_link(app, status, warning):
target = m[0]
# Look for the targets of this link.
labels = [m for m in re.findall(r'\\label\{([^}]*)}', content)
if m == target]
labels = [m for m in re.findall(r'\\label\{([^}]*)}', content) if m == target]
# If everything is correct we should have exactly one target.
assert len(labels) == 1

View File

@ -222,6 +222,7 @@ def test_text_inconsistency_warnings(app, warning):
u'.*/refs_inconsistency.txt:\\d+: WARNING: citation not found: ref3')
assert_re_search(expected_citation_warning_expr, warnings)
@sphinx_intl
@pytest.mark.sphinx('text')
@pytest.mark.test_params(shared_result='test_intl_basic')

View File

@ -96,7 +96,6 @@ def test_do_prompt_inputstrip():
def test_do_prompt_with_nonascii():
d = {}
answers = {
'Q1': u'\u30c9\u30a4\u30c4',
}

View File

@ -95,7 +95,6 @@ def test_parselinenos():
parselinenos('3-1', 10)
def test_xmlname_check():
checker = xmlname_checker()
assert checker.match('id-pub')

View File

@ -113,7 +113,6 @@ def test_getargspec_bound_methods():
assert expected_bound == inspect.getargspec(wrapped_bound_method)
def test_Signature():
# literals
with pytest.raises(TypeError):