Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Reformat long REFERRER_POLICY.

Andrey Rakhmatullin176ae348c57a
diff --git a/tests/test_spidermiddleware_referer.py b/tests/test_spidermiddleware_referer.py
index cefd33e4e..4945ac25d 100644
--- a/tests/test_spidermiddleware_referer.py
+++ b/tests/test_spidermiddleware_referer.py
@@ -891,7 +891,12 @@ class TestSettingsPolicyByName(TestCase):
# test parsing without space(s) after the comma
settings1 = Settings(
{
- "REFERRER_POLICY": f"some-custom-unknown-policy,{POLICY_SAME_ORIGIN},{POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN},another-custom-unknown-policy"
+ "REFERRER_POLICY": (
+ f"some-custom-unknown-policy,"
+ f"{POLICY_SAME_ORIGIN},"
+ f"{POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN},"
+ f"another-custom-unknown-policy"
+ )
}
)
mw1 = RefererMiddleware(settings1)
@@ -900,7 +905,11 @@ class TestSettingsPolicyByName(TestCase):
# test parsing with space(s) after the comma
settings2 = Settings(
{
- "REFERRER_POLICY": f"{POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN}, another-custom-unknown-policy, {POLICY_UNSAFE_URL}"
+ "REFERRER_POLICY": (
+ f"{POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN},"
+ f" another-custom-unknown-policy,"
+ f" {POLICY_UNSAFE_URL}"
+ )
}
)
mw2 = RefererMiddleware(settings2)
@@ -909,7 +918,11 @@ class TestSettingsPolicyByName(TestCase):
def test_multiple_policy_tokens_all_invalid(self):
settings = Settings(
{
- "REFERRER_POLICY": "some-custom-unknown-policy,another-custom-unknown-policy,yet-another-custom-unknown-policy"
+ "REFERRER_POLICY": (
+ "some-custom-unknown-policy,"
+ "another-custom-unknown-policy,"
+ "yet-another-custom-unknown-policy"
+ )
}
)
with self.assertRaises(RuntimeError):