1
0
Fork 0
forked from github/pelican

ruff UP031 in files: use format specifiers instead of percent format

This commit is contained in:
boxydog 2024-06-01 16:00:17 -05:00
commit 30bde3823f
12 changed files with 47 additions and 50 deletions

View file

@ -282,7 +282,7 @@ class TestPage(TestBase):
#
# Until we find some other method to test this functionality, we
# will simply skip this test.
unittest.skip("There is no locale %s in this system." % locale)
unittest.skip(f"There is no locale {locale} in this system.")
def test_template(self):
# Pages default to page, metadata overwrites

View file

@ -148,7 +148,7 @@ class TestWordpressXmlImporter(TestCaseWithCLocale):
test_post = filter(lambda p: p[0].startswith("Empty Page"), self.posts)
with temporary_folder() as temp:
fname = next(iter(silent_f2p(test_post, "markdown", temp, dirpage=True)))
self.assertTrue(fname.endswith("pages%sempty.md" % os.path.sep))
self.assertTrue(fname.endswith(f"pages{os.path.sep}empty.md"))
def test_dircat(self):
silent_f2p = mute(True)(fields2pelican)

View file

@ -71,8 +71,7 @@ class TestPelican(LoggedTestCase):
if proc.returncode != 0:
msg = self._formatMessage(
msg,
"%s and %s differ:\nstdout:\n%s\nstderr\n%s"
% (left_path, right_path, out, err),
f"{left_path} and {right_path} differ:\nstdout:\n{out}\nstderr\n{err}",
)
raise self.failureException(msg)

View file

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

View file

@ -721,11 +721,11 @@ class TestCopy(unittest.TestCase):
def _exist_file(self, *path):
path = os.path.join(self.root_dir, *path)
self.assertTrue(os.path.isfile(path), "File does not exist: %s" % path)
self.assertTrue(os.path.isfile(path), f"File does not exist: {path}")
def _exist_dir(self, *path):
path = os.path.join(self.root_dir, *path)
self.assertTrue(os.path.exists(path), "Directory does not exist: %s" % path)
self.assertTrue(os.path.exists(path), f"Directory does not exist: {path}")
def test_copy_file_same_path(self):
self._create_file("a.txt")