forked from github/pelican
More ruff fixes in files: stop ignoring C408, UP007, PLR5501, B006
This commit is contained in:
parent
3624bcdbf4
commit
7577dd7603
16 changed files with 72 additions and 82 deletions
|
|
@ -314,7 +314,7 @@ class TestPage(TestBase):
|
|||
args["settings"] = settings
|
||||
|
||||
# Tag
|
||||
args["content"] = "A simple test, with a " '<a href="|tag|tagname">link</a>'
|
||||
args["content"] = 'A simple test, with a <a href="|tag|tagname">link</a>'
|
||||
page = Page(**args)
|
||||
content = page.get_content("http://notmyidea.org")
|
||||
self.assertEqual(
|
||||
|
|
@ -326,9 +326,7 @@ class TestPage(TestBase):
|
|||
)
|
||||
|
||||
# Category
|
||||
args["content"] = (
|
||||
"A simple test, with a " '<a href="|category|category">link</a>'
|
||||
)
|
||||
args["content"] = 'A simple test, with a <a href="|category|category">link</a>'
|
||||
page = Page(**args)
|
||||
content = page.get_content("http://notmyidea.org")
|
||||
self.assertEqual(
|
||||
|
|
@ -350,7 +348,7 @@ class TestPage(TestBase):
|
|||
|
||||
# Classic intrasite link via filename
|
||||
args["content"] = (
|
||||
"A simple test, with a " '<a href="|filename|article.rst">link</a>'
|
||||
'A simple test, with a <a href="|filename|article.rst">link</a>'
|
||||
)
|
||||
content = Page(**args).get_content("http://notmyidea.org")
|
||||
self.assertEqual(
|
||||
|
|
@ -401,7 +399,7 @@ class TestPage(TestBase):
|
|||
|
||||
# also test for summary in metadata
|
||||
parsed = (
|
||||
"A simple summary test, with a " '<a href="|filename|article.rst">link</a>'
|
||||
'A simple summary test, with a <a href="|filename|article.rst">link</a>'
|
||||
)
|
||||
linked = (
|
||||
"A simple summary test, with a "
|
||||
|
|
@ -594,7 +592,7 @@ class TestPage(TestBase):
|
|||
|
||||
# An intrasite link via filename with %20 as a space
|
||||
args["content"] = (
|
||||
"A simple test, with a " '<a href="|filename|article%20spaces.rst">link</a>'
|
||||
'A simple test, with a <a href="|filename|article%20spaces.rst">link</a>'
|
||||
)
|
||||
content = Page(**args).get_content("http://notmyidea.org")
|
||||
self.assertEqual(
|
||||
|
|
@ -834,10 +832,10 @@ class TestStatic(LoggedTestCase):
|
|||
|
||||
otherdir_settings = self.settings.copy()
|
||||
otherdir_settings.update(
|
||||
dict(
|
||||
PAGE_SAVE_AS=os.path.join("otherpages", "{slug}.html"),
|
||||
PAGE_URL="otherpages/{slug}.html",
|
||||
)
|
||||
{
|
||||
"PAGE_SAVE_AS": os.path.join("otherpages", "{slug}.html"),
|
||||
"PAGE_URL": "otherpages/{slug}.html",
|
||||
}
|
||||
)
|
||||
otherdir_page = Page(
|
||||
content="other page",
|
||||
|
|
@ -892,7 +890,7 @@ class TestStatic(LoggedTestCase):
|
|||
"""
|
||||
customstatic = Static(
|
||||
content=None,
|
||||
metadata=dict(save_as="customfoo.jpg", url="customfoo.jpg"),
|
||||
metadata={"save_as": "customfoo.jpg", "url": "customfoo.jpg"},
|
||||
settings=self.settings,
|
||||
source_path=os.path.join("dir", "foo.jpg"),
|
||||
context=self.settings.copy(),
|
||||
|
|
@ -1066,9 +1064,9 @@ class TestStatic(LoggedTestCase):
|
|||
|
||||
static = Static(
|
||||
content=None,
|
||||
metadata=dict(
|
||||
status="draft",
|
||||
),
|
||||
metadata={
|
||||
"status": "draft",
|
||||
},
|
||||
settings=self.settings,
|
||||
source_path=os.path.join("dir", "foo.jpg"),
|
||||
context=self.settings.copy(),
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class TestBloggerXmlImporter(TestCaseWithCLocale):
|
|||
)
|
||||
comment_titles = {x[0] for x in test_posts if x[8] == "comment"}
|
||||
self.assertEqual(
|
||||
{"Mishka, always a pleasure to read your " "adventures!..."}, comment_titles
|
||||
{"Mishka, always a pleasure to read your adventures!..."}, comment_titles
|
||||
)
|
||||
|
||||
def test_recognise_status_with_correct_filename(self):
|
||||
|
|
@ -478,7 +478,7 @@ class TestBuildHeader(unittest.TestCase):
|
|||
attachments=["output/test1", "output/test2"],
|
||||
)
|
||||
self.assertEqual(
|
||||
header, ("test\n####\n" ":attachments: output/test1, " "output/test2\n\n")
|
||||
header, ("test\n####\n:attachments: output/test1, output/test2\n\n")
|
||||
)
|
||||
|
||||
def test_galleries_added_to_markdown_header(self):
|
||||
|
|
@ -521,10 +521,10 @@ class TestWordpressXMLAttachements(TestCaseWithCLocale):
|
|||
self.assertEqual(self.attachments[post], expected)
|
||||
elif post == "with-excerpt":
|
||||
expected_invalid = (
|
||||
"http://thisurlisinvalid.notarealdomain/" "not_an_image.jpg"
|
||||
"http://thisurlisinvalid.notarealdomain/not_an_image.jpg"
|
||||
)
|
||||
expected_pelikan = (
|
||||
"http://en.wikipedia.org/wiki/" "File:Pelikan_Walvis_Bay.jpg"
|
||||
"http://en.wikipedia.org/wiki/File:Pelikan_Walvis_Bay.jpg"
|
||||
)
|
||||
self.assertEqual(
|
||||
self.attachments[post], {expected_invalid, expected_pelikan}
|
||||
|
|
@ -533,9 +533,7 @@ class TestWordpressXMLAttachements(TestCaseWithCLocale):
|
|||
expected_invalid = "http://thisurlisinvalid.notarealdomain"
|
||||
self.assertEqual(self.attachments[post], {expected_invalid})
|
||||
else:
|
||||
self.fail(
|
||||
"all attachments should match to a " f"filename or None, {post}"
|
||||
)
|
||||
self.fail(f"all attachments should match to a filename or None, {post}")
|
||||
|
||||
def test_download_attachments(self):
|
||||
real_file = os.path.join(CUR_DIR, "content/article.rst")
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@ class MdReaderTest(ReaderTest):
|
|||
"modified": SafeDatetime(2012, 11, 1),
|
||||
"multiline": [
|
||||
"Line Metadata should be handle properly.",
|
||||
"See syntax of Meta-Data extension of " "Python Markdown package:",
|
||||
"See syntax of Meta-Data extension of Python Markdown package:",
|
||||
"If a line is indented by 4 or more spaces,",
|
||||
"that line is assumed to be an additional line of the value",
|
||||
"for the previous keyword.",
|
||||
|
|
|
|||
|
|
@ -922,14 +922,14 @@ class TestSanitisedJoin(unittest.TestCase):
|
|||
def test_detect_parent_breakout(self):
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
"Attempted to break out of output directory to " "(.*?:)?/foo/test",
|
||||
"Attempted to break out of output directory to (.*?:)?/foo/test",
|
||||
): # (.*?:)? accounts for Windows root
|
||||
utils.sanitised_join("/foo/bar", "../test")
|
||||
|
||||
def test_detect_root_breakout(self):
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
"Attempted to break out of output directory to " "(.*?:)?/test",
|
||||
"Attempted to break out of output directory to (.*?:)?/test",
|
||||
): # (.*?:)? accounts for Windows root
|
||||
utils.sanitised_join("/foo/bar", "/test")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue