1
0
Fork 0
forked from github/pelican

Update code base for Python 3.8 and above

Result of: pipx run pyupgrade --py38-plus pelican/**/*.py
This commit is contained in:
Justin Mayer 2023-11-12 13:53:02 +01:00
commit ecd598f293
15 changed files with 58 additions and 64 deletions

View file

@ -61,6 +61,6 @@ def test_sdist_contents(pytestconfig, expected_file):
filtered_values = [
path
for path in files_list
if match(f"^pelican-\d\.\d\.\d/{expected_file}{dir_matcher}$", path)
if match(rf"^pelican-\d\.\d\.\d/{expected_file}{dir_matcher}$", path)
]
assert len(filtered_values) > 0

View file

@ -133,7 +133,7 @@ def skipIfNoExecutable(executable):
res = None
if res is None:
return unittest.skip("{} executable not found".format(executable))
return unittest.skip(f"{executable} executable not found")
return lambda func: func

View file

@ -32,9 +32,7 @@ class ReaderTest(unittest.TestCase):
% (key, value, real_value),
)
else:
self.fail(
"Expected %s to have value %s, but was not in Dict" % (key, value)
)
self.fail(f"Expected {key} to have value {value}, but was not in Dict")
class TestAssertDictHasSubset(ReaderTest):

View file

@ -170,7 +170,7 @@ class TestSettingsConfiguration(unittest.TestCase):
def test__printf_s_to_format_field(self):
for s in ("%s", "{%s}", "{%s"):
option = "foo/{}/bar.baz".format(s)
option = f"foo/{s}/bar.baz"
result = _printf_s_to_format_field(option, "slug")
expected = option % "qux"
found = result.format(slug="qux")