run pyupgrade
This commit is contained in:
@@ -375,7 +375,7 @@ class TestApprox(object):
|
||||
expected = '4.0e-06'
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines([
|
||||
'*At index 0 diff: 3 != 4 * {0}'.format(expected),
|
||||
'*At index 0 diff: 3 != 4 * {}'.format(expected),
|
||||
'=* 1 failed in *=',
|
||||
])
|
||||
|
||||
|
||||
@@ -1749,7 +1749,7 @@ class TestAutouseManagement(object):
|
||||
def test_2(self):
|
||||
pass
|
||||
""")
|
||||
confcut = "--confcutdir={0}".format(testdir.tmpdir)
|
||||
confcut = "--confcutdir={}".format(testdir.tmpdir)
|
||||
reprec = testdir.inline_run("-v", "-s", confcut)
|
||||
reprec.assertoutcome(passed=8)
|
||||
config = reprec.getcalls("pytest_unconfigure")[0].config
|
||||
@@ -3132,9 +3132,9 @@ class TestParameterizedSubRequest(object):
|
||||
E*Failed: The requested fixture has no parameter defined for the current test.
|
||||
E*
|
||||
E*Requested fixture 'fix_with_param' defined in:
|
||||
E*{0}:4
|
||||
E*{}:4
|
||||
E*Requested here:
|
||||
E*{1}:9
|
||||
E*{}:9
|
||||
*1 error*
|
||||
""".format(testfile.basename, testfile.basename))
|
||||
|
||||
@@ -3154,9 +3154,9 @@ class TestParameterizedSubRequest(object):
|
||||
E*Failed: The requested fixture has no parameter defined for the current test.
|
||||
E*
|
||||
E*Requested fixture 'fix_with_param' defined in:
|
||||
E*{0}:4
|
||||
E*{}:4
|
||||
E*Requested here:
|
||||
E*{1}:8
|
||||
E*{}:8
|
||||
*1 failed*
|
||||
""".format(testfile.basename, testfile.basename))
|
||||
|
||||
@@ -3178,9 +3178,9 @@ class TestParameterizedSubRequest(object):
|
||||
E*Failed: The requested fixture has no parameter defined for the current test.
|
||||
E*
|
||||
E*Requested fixture 'fix_with_param' defined in:
|
||||
E*{0}:4
|
||||
E*{}:4
|
||||
E*Requested here:
|
||||
E*{1}:2
|
||||
E*{}:2
|
||||
*1 failed*
|
||||
""".format(conffile.basename, testfile.basename))
|
||||
|
||||
@@ -3211,9 +3211,9 @@ class TestParameterizedSubRequest(object):
|
||||
E*Failed: The requested fixture has no parameter defined for the current test.
|
||||
E*
|
||||
E*Requested fixture 'fix_with_param' defined in:
|
||||
E*{0}:5
|
||||
E*{}:5
|
||||
E*Requested here:
|
||||
E*{1}:5
|
||||
E*{}:5
|
||||
*1 failed*
|
||||
""".format(fixfile.strpath, testfile.basename))
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ class TestMetafunc(object):
|
||||
pytest.param(re.compile('foo'), re.compile('bar')),
|
||||
pytest.param(str, int),
|
||||
pytest.param(list("six"), [66, 66]),
|
||||
pytest.param(set([7]), set("seven")),
|
||||
pytest.param({7}, set("seven")),
|
||||
pytest.param(tuple("eight"), (8, -8, 8)),
|
||||
pytest.param(b'\xc3\xb4', b"name"),
|
||||
pytest.param(b'\xc3\xb4', totext("other")),
|
||||
@@ -1214,14 +1214,14 @@ class TestMetafuncFunctional(object):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
@pytest.mark.{0}("x", range(2))
|
||||
@pytest.mark.{}("x", range(2))
|
||||
def test_foo(x):
|
||||
pass
|
||||
""".format(attr))
|
||||
reprec = testdir.inline_run('--collectonly')
|
||||
failures = reprec.getfailures()
|
||||
assert len(failures) == 1
|
||||
expectederror = "MarkerError: test_foo has '{0}', spelling should be 'parametrize'".format(attr)
|
||||
expectederror = "MarkerError: test_foo has '{}', spelling should be 'parametrize'".format(attr)
|
||||
assert expectederror in failures[0].longrepr.reprcrash.message
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class TestRaises(object):
|
||||
try:
|
||||
pytest.raises(ValueError, int, '0')
|
||||
except pytest.raises.Exception as e:
|
||||
assert e.msg == "DID NOT RAISE {0}".format(repr(ValueError))
|
||||
assert e.msg == "DID NOT RAISE {}".format(repr(ValueError))
|
||||
else:
|
||||
assert False, "Expected pytest.raises.Exception"
|
||||
|
||||
@@ -83,7 +83,7 @@ class TestRaises(object):
|
||||
with pytest.raises(ValueError):
|
||||
pass
|
||||
except pytest.raises.Exception as e:
|
||||
assert e.msg == "DID NOT RAISE {0}".format(repr(ValueError))
|
||||
assert e.msg == "DID NOT RAISE {}".format(repr(ValueError))
|
||||
else:
|
||||
assert False, "Expected pytest.raises.Exception"
|
||||
|
||||
@@ -134,7 +134,7 @@ class TestRaises(object):
|
||||
int('asdf')
|
||||
|
||||
msg = "with base 16"
|
||||
expr = r"Pattern '{0}' not found in 'invalid literal for int\(\) with base 10: 'asdf''".format(msg)
|
||||
expr = r"Pattern '{}' not found in 'invalid literal for int\(\) with base 10: 'asdf''".format(msg)
|
||||
with pytest.raises(AssertionError, match=expr):
|
||||
with pytest.raises(ValueError, match=msg):
|
||||
int('asdf', base=10)
|
||||
|
||||
Reference in New Issue
Block a user