Fixed E131 flake8 errors

continuation line unaligned for hanging indent
This commit is contained in:
Andras Tim 2017-07-17 01:25:07 +02:00
parent 1c935db571
commit df54bf0db5
10 changed files with 65 additions and 65 deletions

View File

@ -103,9 +103,9 @@ _preinit = []
default_plugins = ( default_plugins = (
"mark main terminal runner python fixtures debugging unittest capture skipping " "mark main terminal runner python fixtures debugging unittest capture skipping "
"tmpdir monkeypatch recwarn pastebin helpconfig nose assertion " "tmpdir monkeypatch recwarn pastebin helpconfig nose assertion "
"junitxml resultlog doctest cacheprovider freeze_support " "junitxml resultlog doctest cacheprovider freeze_support "
"setuponly setupplan warnings").split() "setuponly setupplan warnings").split()
builtin_plugins = set(default_plugins) builtin_plugins = set(default_plugins)

View File

@ -419,7 +419,7 @@ class Module(main.File, PyCollector):
" %s\n" " %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a " "HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" "unique basename for your test file modules"
% e.args % e.args
) )
except ImportError: except ImportError:
from _pytest._code.code import ExceptionInfo from _pytest._code.code import ExceptionInfo

View File

@ -201,4 +201,4 @@ class WarningsChecker(WarningsRecorder):
fail("DID NOT WARN. No warnings of type {0} was emitted. " fail("DID NOT WARN. No warnings of type {0} was emitted. "
"The list of emitted warnings is: {1}.".format( "The list of emitted warnings is: {1}.".format(
self.expected_warning, self.expected_warning,
[each.message for each in self])) [each.message for each in self]))

View File

@ -935,9 +935,9 @@ raise ValueError()
{'style': style, 'showlocals': showlocals, {'style': style, 'showlocals': showlocals,
'funcargs': funcargs, 'tbfilter': tbfilter 'funcargs': funcargs, 'tbfilter': tbfilter
} for style in ("long", "short", "no") } for style in ("long", "short", "no")
for showlocals in (True, False) for showlocals in (True, False)
for tbfilter in (True, False) for tbfilter in (True, False)
for funcargs in (True, False)]) for funcargs in (True, False)])
def test_format_excinfo(self, importasmod, reproptions): def test_format_excinfo(self, importasmod, reproptions):
mod = importasmod(""" mod = importasmod("""
def g(x): def g(x):

View File

@ -44,13 +44,13 @@ class TestApprox(object):
def test_exactly_equal(self): def test_exactly_equal(self):
examples = [ examples = [
(2.0, 2.0), (2.0, 2.0),
(0.1e200, 0.1e200), (0.1e200, 0.1e200),
(1.123e-300, 1.123e-300), (1.123e-300, 1.123e-300),
(12345, 12345.0), (12345, 12345.0),
(0.0, -0.0), (0.0, -0.0),
(345678, 345678), (345678, 345678),
(Decimal('1.0001'), Decimal('1.0001')), (Decimal('1.0001'), Decimal('1.0001')),
(Fraction(1, 3), Fraction(-1, -3)), (Fraction(1, 3), Fraction(-1, -3)),
] ]
for a, x in examples: for a, x in examples:
assert a == approx(x) assert a == approx(x)
@ -58,7 +58,7 @@ class TestApprox(object):
def test_opposite_sign(self): def test_opposite_sign(self):
examples = [ examples = [
(eq, 1e-100, -1e-100), (eq, 1e-100, -1e-100),
(ne, 1e100, -1e100), (ne, 1e100, -1e100),
] ]
for op, a, x in examples: for op, a, x in examples:
assert op(a, approx(x)) assert op(a, approx(x))
@ -66,7 +66,7 @@ class TestApprox(object):
def test_zero_tolerance(self): def test_zero_tolerance(self):
within_1e10 = [ within_1e10 = [
(1.1e-100, 1e-100), (1.1e-100, 1e-100),
(-1.1e-100, -1e-100), (-1.1e-100, -1e-100),
] ]
for a, x in within_1e10: for a, x in within_1e10:
assert x == approx(x, rel=0.0, abs=0.0) assert x == approx(x, rel=0.0, abs=0.0)
@ -93,9 +93,9 @@ class TestApprox(object):
# Everything should be equal if the tolerance is infinite. # Everything should be equal if the tolerance is infinite.
large_diffs = [ large_diffs = [
(1, 1000), (1, 1000),
(1e-50, 1e50), (1e-50, 1e50),
(-1.0, -1e300), (-1.0, -1e300),
(0.0, 10), (0.0, 10),
] ]
for a, x in large_diffs: for a, x in large_diffs:
assert a != approx(x, rel=0.0, abs=0.0) assert a != approx(x, rel=0.0, abs=0.0)
@ -136,14 +136,14 @@ class TestApprox(object):
# the choice of defaults. # the choice of defaults.
examples = [ examples = [
# Relative tolerance used. # Relative tolerance used.
(eq, 1e100 + 1e94, 1e100), (eq, 1e100 + 1e94, 1e100),
(ne, 1e100 + 2e94, 1e100), (ne, 1e100 + 2e94, 1e100),
(eq, 1e0 + 1e-6, 1e0), (eq, 1e0 + 1e-6, 1e0),
(ne, 1e0 + 2e-6, 1e0), (ne, 1e0 + 2e-6, 1e0),
# Absolute tolerance used. # Absolute tolerance used.
(eq, 1e-100, + 1e-106), (eq, 1e-100, + 1e-106),
(eq, 1e-100, + 2e-106), (eq, 1e-100, + 2e-106),
(eq, 1e-100, 0), (eq, 1e-100, 0),
] ]
for op, a, x in examples: for op, a, x in examples:
assert op(a, approx(x)) assert op(a, approx(x))
@ -167,8 +167,8 @@ class TestApprox(object):
def test_relative_tolerance(self): def test_relative_tolerance(self):
within_1e8_rel = [ within_1e8_rel = [
(1e8 + 1e0, 1e8), (1e8 + 1e0, 1e8),
(1e0 + 1e-8, 1e0), (1e0 + 1e-8, 1e0),
(1e-8 + 1e-16, 1e-8), (1e-8 + 1e-16, 1e-8),
] ]
for a, x in within_1e8_rel: for a, x in within_1e8_rel:
assert a == approx(x, rel=5e-8, abs=0.0) assert a == approx(x, rel=5e-8, abs=0.0)
@ -177,8 +177,8 @@ class TestApprox(object):
def test_absolute_tolerance(self): def test_absolute_tolerance(self):
within_1e8_abs = [ within_1e8_abs = [
(1e8 + 9e-9, 1e8), (1e8 + 9e-9, 1e8),
(1e0 + 9e-9, 1e0), (1e0 + 9e-9, 1e0),
(1e-8 + 9e-9, 1e-8), (1e-8 + 9e-9, 1e-8),
] ]
for a, x in within_1e8_abs: for a, x in within_1e8_abs:
assert a == approx(x, rel=0, abs=5e-8) assert a == approx(x, rel=0, abs=5e-8)
@ -202,10 +202,10 @@ class TestApprox(object):
def test_expecting_inf(self): def test_expecting_inf(self):
examples = [ examples = [
(eq, inf, inf), (eq, inf, inf),
(eq, -inf, -inf), (eq, -inf, -inf),
(ne, inf, -inf), (ne, inf, -inf),
(ne, 0.0, inf), (ne, 0.0, inf),
(ne, nan, inf), (ne, nan, inf),
] ]
for op, a, x in examples: for op, a, x in examples:
assert op(a, approx(x)) assert op(a, approx(x))
@ -213,10 +213,10 @@ class TestApprox(object):
def test_expecting_nan(self): def test_expecting_nan(self):
examples = [ examples = [
(nan, nan), (nan, nan),
(-nan, -nan), (-nan, -nan),
(nan, -nan), (nan, -nan),
(0.0, nan), (0.0, nan),
(inf, nan), (inf, nan),
] ]
for a, x in examples: for a, x in examples:
# If there is a relative tolerance and the expected value is NaN, # If there is a relative tolerance and the expected value is NaN,
@ -231,8 +231,8 @@ class TestApprox(object):
def test_expecting_sequence(self): def test_expecting_sequence(self):
within_1e8 = [ within_1e8 = [
(1e8 + 1e0, 1e8), (1e8 + 1e0, 1e8),
(1e0 + 1e-8, 1e0), (1e0 + 1e-8, 1e0),
(1e-8 + 1e-16, 1e-8), (1e-8 + 1e-16, 1e-8),
] ]
actual, expected = zip(*within_1e8) actual, expected = zip(*within_1e8)
assert actual == approx(expected, rel=5e-8, abs=0.0) assert actual == approx(expected, rel=5e-8, abs=0.0)
@ -244,9 +244,9 @@ class TestApprox(object):
def test_complex(self): def test_complex(self):
within_1e6 = [ within_1e6 = [
( 1.000001 + 1.0j, 1.0 + 1.0j), ( 1.000001 + 1.0j, 1.0 + 1.0j),
(1.0 + 1.000001j, 1.0 + 1.0j), (1.0 + 1.000001j, 1.0 + 1.0j),
(-1.000001 + 1.0j, -1.0 + 1.0j), (-1.000001 + 1.0j, -1.0 + 1.0j),
(1.0 - 1.000001j, 1.0 - 1.0j), (1.0 - 1.000001j, 1.0 - 1.0j),
] ]
for a, x in within_1e6: for a, x in within_1e6:
assert a == approx(x, rel=5e-6, abs=0) assert a == approx(x, rel=5e-6, abs=0)
@ -255,7 +255,7 @@ class TestApprox(object):
def test_int(self): def test_int(self):
within_1e6 = [ within_1e6 = [
(1000001, 1000000), (1000001, 1000000),
(-1000001, -1000000), (-1000001, -1000000),
] ]
for a, x in within_1e6: for a, x in within_1e6:
assert a == approx(x, rel=5e-6, abs=0) assert a == approx(x, rel=5e-6, abs=0)
@ -264,7 +264,7 @@ class TestApprox(object):
def test_decimal(self): def test_decimal(self):
within_1e6 = [ within_1e6 = [
(Decimal('1.000001'), Decimal('1.0')), (Decimal('1.000001'), Decimal('1.0')),
(Decimal('-1.000001'), Decimal('-1.0')), (Decimal('-1.000001'), Decimal('-1.0')),
] ]
for a, x in within_1e6: for a, x in within_1e6:
assert a == approx(x, rel=Decimal('5e-6'), abs=0) assert a == approx(x, rel=Decimal('5e-6'), abs=0)
@ -273,7 +273,7 @@ class TestApprox(object):
def test_fraction(self): def test_fraction(self):
within_1e6 = [ within_1e6 = [
(1 + Fraction(1, 1000000), Fraction(1)), (1 + Fraction(1, 1000000), Fraction(1)),
(-1 - Fraction(-1, 1000000), Fraction(-1)), (-1 - Fraction(-1, 1000000), Fraction(-1)),
] ]
for a, x in within_1e6: for a, x in within_1e6:
assert a == approx(x, rel=5e-6, abs=0) assert a == approx(x, rel=5e-6, abs=0)

View File

@ -773,11 +773,11 @@ def test_assertrepr_loaded_per_dir(testdir):
result = testdir.runpytest() result = testdir.runpytest()
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
'*def test_base():*', '*def test_base():*',
'*E*assert 1 == 2*', '*E*assert 1 == 2*',
'*def test_a():*', '*def test_a():*',
'*E*assert summary a*', '*E*assert summary a*',
'*def test_b():*', '*def test_b():*',
'*E*assert summary b*']) '*E*assert summary b*'])
def test_assertion_options(testdir): def test_assertion_options(testdir):

View File

@ -201,9 +201,9 @@ def test_strict_prohibits_unregistered_markers(testdir):
@pytest.mark.parametrize("spec", [ @pytest.mark.parametrize("spec", [
("xyz", ("test_one",)), ("xyz", ("test_one",)),
("xyz and xyz2", ()), ("xyz and xyz2", ()),
("xyz2", ("test_two",)), ("xyz2", ("test_two",)),
("xyz or xyz2", ("test_one", "test_two"),) ("xyz or xyz2", ("test_one", "test_two"),)
]) ])
def test_mark_option(spec, testdir): def test_mark_option(spec, testdir):
testdir.makepyfile(""" testdir.makepyfile("""
@ -224,7 +224,7 @@ def test_mark_option(spec, testdir):
@pytest.mark.parametrize("spec", [ @pytest.mark.parametrize("spec", [
("interface", ("test_interface",)), ("interface", ("test_interface",)),
("not interface", ("test_nointer",)), ("not interface", ("test_nointer",)),
]) ])
def test_mark_option_custom(spec, testdir): def test_mark_option_custom(spec, testdir):
testdir.makeconftest(""" testdir.makeconftest("""
@ -249,9 +249,9 @@ def test_mark_option_custom(spec, testdir):
@pytest.mark.parametrize("spec", [ @pytest.mark.parametrize("spec", [
("interface", ("test_interface",)), ("interface", ("test_interface",)),
("not interface", ("test_nointer", "test_pass")), ("not interface", ("test_nointer", "test_pass")),
("pass", ("test_pass",)), ("pass", ("test_pass",)),
("not pass", ("test_interface", "test_nointer")), ("not pass", ("test_interface", "test_nointer")),
]) ])
def test_keyword_option_custom(spec, testdir): def test_keyword_option_custom(spec, testdir):
testdir.makepyfile(""" testdir.makepyfile("""
@ -272,8 +272,8 @@ def test_keyword_option_custom(spec, testdir):
@pytest.mark.parametrize("spec", [ @pytest.mark.parametrize("spec", [
("None", ("test_func[None]",)), ("None", ("test_func[None]",)),
("1.3", ("test_func[1.3]",)), ("1.3", ("test_func[1.3]",)),
("2-3", ("test_func[2-3]",)) ("2-3", ("test_func[2-3]",))
]) ])
def test_keyword_option_parametrize(spec, testdir): def test_keyword_option_parametrize(spec, testdir):
testdir.makepyfile(""" testdir.makepyfile("""

View File

@ -699,7 +699,7 @@ def test_skipped_reasons_functional(testdir):
def test_method(self): def test_method(self):
doskip() doskip()
""", """,
conftest = """ conftest = """
import pytest import pytest
def doskip(): def doskip():
pytest.skip('test') pytest.skip('test')

View File

@ -223,7 +223,7 @@ class TestCollectonly(object):
result = testdir.runpytest("--collect-only",) result = testdir.runpytest("--collect-only",)
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"<Module 'test_collectonly_basic.py'>", "<Module 'test_collectonly_basic.py'>",
" <Function 'test_func'>", " <Function 'test_func'>",
]) ])
def test_collectonly_skipped_module(self, testdir): def test_collectonly_skipped_module(self, testdir):

View File

@ -196,6 +196,6 @@ filterwarnings =
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
[flake8] [flake8]
ignore = E131,E201,E202,E203,E221,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731 ignore = E201,E202,E203,E221,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E272,E293,E301,E302,E303,E401,E402,E501,E701,E702,E704,E712,E731
max-line-length = 120 max-line-length = 120
exclude = _pytest/vendored_packages/pluggy.py exclude = _pytest/vendored_packages/pluggy.py