1
0
Fork 0
forked from github/pelican

The ruff and ruff-format fixes

This commit is contained in:
boxydog 2024-05-30 09:05:36 -05:00
commit 6d8597addb
24 changed files with 48 additions and 79 deletions

View file

@ -1,6 +1,6 @@
from re import match
import tarfile
from pathlib import Path
from re import match
from zipfile import ZipFile
import pytest

View file

@ -261,9 +261,7 @@ class LoggedTestCase(unittest.TestCase):
self.assertEqual(
actual,
count,
msg="expected {} occurrences of {!r}, but found {}".format(
count, msg, actual
),
msg=f"expected {count} occurrences of {msg!r}, but found {actual}",
)

View file

@ -6,7 +6,6 @@ from unittest.mock import MagicMock
from pelican.generators import ArticlesGenerator, PagesGenerator
from pelican.tests.support import get_context, get_settings, unittest
CUR_DIR = os.path.dirname(__file__)
CONTENT_DIR = os.path.join(CUR_DIR, "content")

View file

@ -13,7 +13,6 @@ from pelican.settings import DEFAULT_CONFIG
from pelican.tests.support import LoggedTestCase, get_context, get_settings, unittest
from pelican.utils import path_to_url, posixize_path, truncate_html_words
# generate one paragraph, enclosed with <p>
TEST_CONTENT = str(generate_lorem_ipsum(n=1))
TEST_SUMMARY = generate_lorem_ipsum(n=1, html=False)
@ -297,7 +296,6 @@ class TestPage(TestBase):
def test_signal(self):
def receiver_test_function(sender):
receiver_test_function.has_been_called = True
pass
receiver_test_function.has_been_called = False

View file

@ -13,11 +13,11 @@ from pelican.generators import (
TemplatePagesGenerator,
)
from pelican.tests.support import (
TestCaseWithCLocale,
can_symlink,
get_context,
get_settings,
unittest,
TestCaseWithCLocale,
)
from pelican.writers import Writer

View file

@ -5,11 +5,11 @@ from unittest.mock import patch
from pelican.settings import DEFAULT_CONFIG
from pelican.tests.support import (
TestCaseWithCLocale,
mute,
skipIfNoExecutable,
temporary_folder,
unittest,
TestCaseWithCLocale,
)
from pelican.tools.pelican_import import (
blogger2fields,
@ -19,12 +19,12 @@ from pelican.tools.pelican_import import (
download_attachments,
fields2pelican,
get_attachments,
tumblr2fields,
wp2fields,
medium_slug,
mediumpost2fields,
mediumposts2fields,
strip_medium_post_content,
medium_slug,
tumblr2fields,
wp2fields,
)
from pelican.utils import path_to_file_url, slugify
@ -41,7 +41,7 @@ WORDPRESS_DECODED_CONTENT_SAMPLE = os.path.join(
try:
from bs4 import BeautifulSoup
except ImportError:
BeautifulSoup = False # NOQA
BeautifulSoup = False
try:
import bs4.builder._lxml as LXML
@ -532,9 +532,7 @@ class TestWordpressXMLAttachements(TestCaseWithCLocale):
self.assertEqual(self.attachments[post], {expected_invalid})
else:
self.fail(
"all attachments should match to a " "filename or None, {}".format(
post
)
"all attachments should match to a " f"filename or None, {post}"
)
def test_download_attachments(self):

View file

@ -7,7 +7,6 @@ from pelican.paginator import Paginator
from pelican.settings import DEFAULT_CONFIG
from pelican.tests.support import get_settings, unittest
# generate one paragraph, enclosed with <p>
TEST_CONTENT = str(generate_lorem_ipsum(n=1))
TEST_SUMMARY = generate_lorem_ipsum(n=1, html=False)

View file

@ -1,7 +1,6 @@
import os
from contextlib import contextmanager
import pelican.tests.dummy_plugins.normal_plugin.normal_plugin as normal_plugin
from pelican.plugins._utils import (
get_namespace_plugins,
get_plugin_name,
@ -9,6 +8,7 @@ from pelican.plugins._utils import (
plugin_enabled,
)
from pelican.plugins.signals import signal
from pelican.tests.dummy_plugins.normal_plugin import normal_plugin
from pelican.tests.support import unittest

View file

@ -5,7 +5,6 @@ from pelican import readers
from pelican.tests.support import get_settings, unittest
from pelican.utils import SafeDatetime
CUR_DIR = os.path.dirname(__file__)
CONTENT_PATH = os.path.join(CUR_DIR, "content")

View file

@ -3,7 +3,6 @@ import locale
import os
from os.path import abspath, dirname, join
from pelican.settings import (
DEFAULT_CONFIG,
DEFAULT_THEME,