1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

[4.2.x] Refs #33476 -- Applied Black's 2023 stable style.

Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.

https://github.com/psf/black/releases/tag/23.1.0

Backport of 097e3a70c1 from main
This commit is contained in:
David Smith
2023-02-01 07:13:39 +00:00
committed by Mariusz Felisiak
parent 8a7b22d4a6
commit 80aae83439
240 changed files with 37 additions and 281 deletions

14
tests/cache/tests.py vendored
View File

@@ -209,7 +209,7 @@ class DummyCacheTests(SimpleTestCase):
"Iñtërnâtiônàlizætiøn": "Iñtërnâtiônàlizætiøn2",
"ascii2": {"x": 1},
}
for (key, value) in stuff.items():
for key, value in stuff.items():
with self.subTest(key=key):
cache.set(key, value)
self.assertIsNone(cache.get(key))
@@ -514,23 +514,23 @@ class BaseCacheTests:
"ascii2": {"x": 1},
}
# Test `set`
for (key, value) in stuff.items():
for key, value in stuff.items():
with self.subTest(key=key):
cache.set(key, value)
self.assertEqual(cache.get(key), value)
# Test `add`
for (key, value) in stuff.items():
for key, value in stuff.items():
with self.subTest(key=key):
self.assertIs(cache.delete(key), True)
self.assertIs(cache.add(key, value), True)
self.assertEqual(cache.get(key), value)
# Test `set_many`
for (key, value) in stuff.items():
for key, value in stuff.items():
self.assertIs(cache.delete(key), True)
cache.set_many(stuff)
for (key, value) in stuff.items():
for key, value in stuff.items():
with self.subTest(key=key):
self.assertEqual(cache.get(key), value)
@@ -704,6 +704,7 @@ class BaseCacheTests:
portable caching code without making it too difficult to use production
backends with more liberal key rules. Refs #6447.
"""
# mimic custom ``make_key`` method being defined since the default will
# never show the below warnings
def func(key, *args):
@@ -802,7 +803,6 @@ class BaseCacheTests:
self.assertIsNone(caches["v2"].get("answer4", version=2))
def test_cache_versioning_add(self):
# add, default version = 1, but manually override version = 2
self.assertIs(cache.add("answer1", 42, version=2), True)
self.assertIsNone(cache.get("answer1", version=1))
@@ -1149,7 +1149,6 @@ class BaseCacheTests:
)
)
class DBCacheTests(BaseCacheTests, TransactionTestCase):
available_apps = ["cache"]
def setUp(self):
@@ -1468,7 +1467,6 @@ redis_excluded_caches = {"cull", "zero_cull"}
class BaseMemcachedTests(BaseCacheTests):
# By default it's assumed that the client doesn't clean up connections
# properly, in which case the backend must do so after each request.
should_disconnect_on_close = True