summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2025-07-22 20:41:41 -0700
committernessita <124304+nessita@users.noreply.github.com>2025-07-23 20:17:55 -0300
commit69a93a88edb56ba47f624dac7a21aacc47ea474f (patch)
treef57507a4435d032493cae40e06ecb254790b67b2 /tests/utils_tests
parent55b0cc21310b76ce4018dd793ba50556eaf0af06 (diff)
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_csp.py8
-rw-r--r--tests/utils_tests/test_dateformat.py3
-rw-r--r--tests/utils_tests/test_decorators.py3
-rw-r--r--tests/utils_tests/test_functional.py4
-rw-r--r--tests/utils_tests/test_html.py3
-rw-r--r--tests/utils_tests/test_lorem_ipsum.py4
-rw-r--r--tests/utils_tests/test_timesince.py4
7 files changed, 20 insertions, 9 deletions
diff --git a/tests/utils_tests/test_csp.py b/tests/utils_tests/test_csp.py
index 96c66538d0..86682544e2 100644
--- a/tests/utils_tests/test_csp.py
+++ b/tests/utils_tests/test_csp.py
@@ -67,8 +67,9 @@ class CSPBuildPolicyTest(SimpleTestCase):
"""
Test that a set can be passed as a value.
- Sets are often used in Django settings to ensure uniqueness, however, sets are
- unordered. The middleware ensures consistency via sorting if a set is passed.
+ Sets are often used in Django settings to ensure uniqueness, however,
+ sets are unordered. The middleware ensures consistency via sorting if a
+ set is passed.
"""
policy = {"default-src": {CSP.SELF, "foo.com", "bar.com"}}
self.assertPolicyEqual(
@@ -147,7 +148,8 @@ class LazyNonceTests(SimpleTestCase):
return result
with patch("django.utils.csp.secrets.token_urlsafe", memento_token_urlsafe):
- # Force usage, similar to template rendering, to generate the nonce.
+ # Force usage, similar to template rendering, to generate the
+ # nonce.
val = str(nonce)
self.assertTrue(nonce)
diff --git a/tests/utils_tests/test_dateformat.py b/tests/utils_tests/test_dateformat.py
index 9604b0cef4..3f0498bd46 100644
--- a/tests/utils_tests/test_dateformat.py
+++ b/tests/utils_tests/test_dateformat.py
@@ -48,7 +48,8 @@ class DateFormatTests(SimpleTestCase):
dt = make_aware(datetime(2009, 5, 16, 5, 30, 30), ltz)
self.assertEqual(datetime.fromtimestamp(int(format(dt, "U")), tz), dt)
self.assertEqual(datetime.fromtimestamp(int(format(dt, "U")), ltz), dt)
- # astimezone() is safe here because the target timezone doesn't have DST
+ # astimezone() is safe here because the target timezone doesn't have
+ # DST
self.assertEqual(
datetime.fromtimestamp(int(format(dt, "U"))),
dt.astimezone(ltz).replace(tzinfo=None),
diff --git a/tests/utils_tests/test_decorators.py b/tests/utils_tests/test_decorators.py
index 8c0244e819..8e14b53cb7 100644
--- a/tests/utils_tests/test_decorators.py
+++ b/tests/utils_tests/test_decorators.py
@@ -69,7 +69,8 @@ class DecoratorFromMiddlewareTests(SimpleTestCase):
def test_callable_process_view_middleware(self):
"""
- Test a middleware that implements process_view, operating on a callable class.
+ Test a middleware that implements process_view, operating on a callable
+ class.
"""
class_process_view(self.rf.get("/"))
diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py
index 8b5c330bcf..e0a1a76471 100644
--- a/tests/utils_tests/test_functional.py
+++ b/tests/utils_tests/test_functional.py
@@ -127,7 +127,9 @@ class FunctionalTests(SimpleTestCase):
self.assertCachedPropertyWorks(attr, Class)
def test_cached_property_reuse_different_names(self):
- """Disallow this case because the decorated function wouldn't be cached."""
+ """
+ Disallow this case because the decorated function wouldn't be cached.
+ """
type_msg = (
"Cannot assign the same cached_property to two different names ('a' and "
"'b')."
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index 4ce552e79a..284f33aedc 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -170,7 +170,8 @@ class TestUtilsHtml(SimpleTestCase):
strip_tags(value)
def test_strip_tags_files(self):
- # Test with more lengthy content (also catching performance regressions)
+ # Test with more lengthy content (also catching performance
+ # regressions)
for filename in ("strip_tags1.html", "strip_tags2.txt"):
with self.subTest(filename=filename):
path = os.path.join(os.path.dirname(__file__), "files", filename)
diff --git a/tests/utils_tests/test_lorem_ipsum.py b/tests/utils_tests/test_lorem_ipsum.py
index deda09c717..3471053778 100644
--- a/tests/utils_tests/test_lorem_ipsum.py
+++ b/tests/utils_tests/test_lorem_ipsum.py
@@ -18,7 +18,9 @@ class LoremIpsumTests(unittest.TestCase):
self.assertEqual(words(7), "lorem ipsum dolor sit amet consectetur adipisicing")
def test_common_words_in_string(self):
- """words(n) starts with the 19 standard lorem ipsum words for n > 19."""
+ """
+ words(n) starts with the 19 standard lorem ipsum words for n > 19.
+ """
self.assertTrue(
words(25).startswith(
"lorem ipsum dolor sit amet consectetur adipisicing elit sed "
diff --git a/tests/utils_tests/test_timesince.py b/tests/utils_tests/test_timesince.py
index fdcfa4b281..8305a801fc 100644
--- a/tests/utils_tests/test_timesince.py
+++ b/tests/utils_tests/test_timesince.py
@@ -138,7 +138,9 @@ class TimesinceTests(TestCase):
self.assertEqual(timeuntil(now_tz, now_tz_i), "0\xa0minutes")
def test_date_objects(self):
- """Both timesince and timeuntil should work on date objects (#17937)."""
+ """
+ Both timesince and timeuntil should work on date objects (#17937).
+ """
today = datetime.date.today()
self.assertEqual(timesince(today + self.oneday), "0\xa0minutes")
self.assertEqual(timeuntil(today - self.oneday), "0\xa0minutes")