py36+: pyupgrade: py36+

This commit is contained in:
Anthony Sottile
2020-10-02 13:16:22 -07:00
parent b1bcb9fba8
commit 66bd44c13a
66 changed files with 264 additions and 346 deletions

View File

@@ -471,7 +471,7 @@ class TestApprox:
expected = "4.0e-06"
result = testdir.runpytest()
result.stdout.fnmatch_lines(
["*At index 0 diff: 3 != 4 ± {}".format(expected), "=* 1 failed in *="]
[f"*At index 0 diff: 3 != 4 ± {expected}", "=* 1 failed in *="]
)
@pytest.mark.parametrize(
@@ -483,8 +483,7 @@ class TestApprox:
)
def test_expected_value_type_error(self, x, name):
with pytest.raises(
TypeError,
match=r"pytest.approx\(\) does not support nested {}:".format(name),
TypeError, match=fr"pytest.approx\(\) does not support nested {name}:",
):
approx(x)

View File

@@ -1993,7 +1993,7 @@ class TestAutouseManagement:
pass
"""
)
confcut = "--confcutdir={}".format(testdir.tmpdir)
confcut = f"--confcutdir={testdir.tmpdir}"
reprec = testdir.inline_run("-v", "-s", confcut)
reprec.assertoutcome(passed=8)
config = reprec.getcalls("pytest_unconfigure")[0].config
@@ -3796,7 +3796,7 @@ class TestParameterizedSubRequest:
" test_foos.py::test_foo",
"",
"Requested fixture 'fix_with_param' defined in:",
"{}:4".format(fixfile),
f"{fixfile}:4",
"Requested here:",
"test_foos.py:4",
"*1 failed*",
@@ -3813,9 +3813,9 @@ class TestParameterizedSubRequest:
" test_foos.py::test_foo",
"",
"Requested fixture 'fix_with_param' defined in:",
"{}:4".format(fixfile),
f"{fixfile}:4",
"Requested here:",
"{}:4".format(testfile),
f"{testfile}:4",
"*1 failed*",
]
)

View File

@@ -211,7 +211,7 @@ class TestRaises:
pytest.raises(TypeError, int, match="invalid")
def tfunc(match):
raise ValueError("match={}".format(match))
raise ValueError(f"match={match}")
pytest.raises(ValueError, tfunc, match="asdf").match("match=asdf")
pytest.raises(ValueError, tfunc, match="").match("match=")