summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2025-03-01 19:41:37 +0100
committerGitHub <noreply@github.com>2025-03-01 19:41:37 +0100
commitff3aaf036f0cb66cd8f404cd51c603e68aaa7676 (patch)
treea8381709777a84aad1c3c679dc5807bab6f486db /tests
parentea1e3703bee28bfbe4f32ceb39ad31763353b143 (diff)
Applied Black's 2025 stable style.
https://github.com/psf/black/releases/tag/25.1.0
Diffstat (limited to 'tests')
-rw-r--r--tests/admin_views/models.py1
-rw-r--r--tests/admin_views/tests.py2
-rw-r--r--tests/auth_tests/test_validators.py6
-rw-r--r--tests/backends/tests.py2
-rw-r--r--tests/forms_tests/tests/test_utils.py4
-rw-r--r--tests/gis_tests/distapp/models.py7
-rw-r--r--tests/model_fields/test_binaryfield.py2
-rw-r--r--tests/postgres_tests/test_constraints.py2
-rw-r--r--tests/serializers/test_data.py2
-rw-r--r--tests/serializers/test_xml.py2
-rw-r--r--tests/utils_tests/test_text.py14
11 files changed, 26 insertions, 18 deletions
diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py
index 812505de82..a20130bb02 100644
--- a/tests/admin_views/models.py
+++ b/tests/admin_views/models.py
@@ -546,6 +546,7 @@ class SuperVillain(Villain):
class FunkyTag(models.Model):
"Because we all know there's only one real use case for GFKs."
+
name = models.CharField(max_length=25)
content_type = models.ForeignKey(ContentType, models.CASCADE)
object_id = models.PositiveIntegerField()
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 83e96f8749..1fa2c62353 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -7158,7 +7158,7 @@ class ReadonlyTest(AdminFieldExtractionMixin, TestCase):
url = reverse("admin:admin_views_pizza_change", args=(pizza.pk,))
with self.settings(LANGUAGE_CODE="fr"):
response = self.client.get(url)
- self.assertContains(response, "<label>Toppings\u00A0:</label>", html=True)
+ self.assertContains(response, "<label>Toppings\u00a0:</label>", html=True)
@override_settings(ROOT_URLCONF="admin_views.urls")
diff --git a/tests/auth_tests/test_validators.py b/tests/auth_tests/test_validators.py
index d6ee44511d..ea75c4a080 100644
--- a/tests/auth_tests/test_validators.py
+++ b/tests/auth_tests/test_validators.py
@@ -350,10 +350,10 @@ class UsernameValidatorsTests(SimpleTestCase):
invalid_usernames = [
"o'connell",
"عبد ال",
- "zerowidth\u200Bspace",
- "nonbreaking\u00A0space",
+ "zerowidth\u200bspace",
+ "nonbreaking\u00a0space",
"en\u2013dash",
- "trailingnewline\u000A",
+ "trailingnewline\u000a",
]
v = validators.UnicodeUsernameValidator()
for valid in valid_usernames:
diff --git a/tests/backends/tests.py b/tests/backends/tests.py
index 4ba961bfc1..0e5348e248 100644
--- a/tests/backends/tests.py
+++ b/tests/backends/tests.py
@@ -95,7 +95,7 @@ class LastExecutedQueryTest(TestCase):
def test_query_encoding(self):
"""last_executed_query() returns a string."""
- data = RawData.objects.filter(raw_data=b"\x00\x46 \xFE").extra(
+ data = RawData.objects.filter(raw_data=b"\x00\x46 \xfe").extra(
select={"föö": 1}
)
sql, params = data.query.sql_with_params()
diff --git a/tests/forms_tests/tests/test_utils.py b/tests/forms_tests/tests/test_utils.py
index a50f86c934..b8fbadc2b8 100644
--- a/tests/forms_tests/tests/test_utils.py
+++ b/tests/forms_tests/tests/test_utils.py
@@ -73,7 +73,7 @@ class FormsUtilsTestCase(SimpleTestCase):
)
# Can take a Unicode string.
self.assertHTMLEqual(
- str(ErrorList(ValidationError("Not \u03C0.").messages)),
+ str(ErrorList(ValidationError("Not \u03c0.").messages)),
'<ul class="errorlist"><li>Not π.</li></ul>',
)
# Can take a lazy string.
@@ -107,7 +107,7 @@ class FormsUtilsTestCase(SimpleTestCase):
ValidationError(
[
"1. First error.",
- "2. Not \u03C0.",
+ "2. Not \u03c0.",
gettext_lazy("3. Error."),
{
"error_1": "4. First dict error.",
diff --git a/tests/gis_tests/distapp/models.py b/tests/gis_tests/distapp/models.py
index b7b60ebf38..ff0045b82e 100644
--- a/tests/gis_tests/distapp/models.py
+++ b/tests/gis_tests/distapp/models.py
@@ -15,17 +15,20 @@ class NamedModel(models.Model):
class SouthTexasCity(NamedModel):
"City model on projected coordinate system for South Texas."
+
point = models.PointField(srid=32140)
radius = models.IntegerField(default=10000)
class SouthTexasCityFt(NamedModel):
"Same City model as above, but U.S. survey feet are the units."
+
point = models.PointField(srid=2278)
class AustraliaCity(NamedModel):
"City model for Australia, using WGS84."
+
point = models.PointField()
radius = models.IntegerField(default=10000)
allowed_distance = models.FloatField(default=0.5)
@@ -34,19 +37,23 @@ class AustraliaCity(NamedModel):
class CensusZipcode(NamedModel):
"Model for a few South Texas ZIP codes (in original Census NAD83)."
+
poly = models.PolygonField(srid=4269)
class SouthTexasZipcode(NamedModel):
"Model for a few South Texas ZIP codes."
+
poly = models.PolygonField(srid=32140, null=gisfield_may_be_null)
class Interstate(NamedModel):
"Geodetic model for U.S. Interstates."
+
path = models.LineStringField()
class SouthTexasInterstate(NamedModel):
"Projected model for South Texas Interstates."
+
path = models.LineStringField(srid=32140)
diff --git a/tests/model_fields/test_binaryfield.py b/tests/model_fields/test_binaryfield.py
index 05ebce3aab..9d89fdff0b 100644
--- a/tests/model_fields/test_binaryfield.py
+++ b/tests/model_fields/test_binaryfield.py
@@ -6,7 +6,7 @@ from .models import DataModel
class BinaryFieldTests(TestCase):
- binary_data = b"\x00\x46\xFE"
+ binary_data = b"\x00\x46\xfe"
def test_set_and_retrieve(self):
data_set = (
diff --git a/tests/postgres_tests/test_constraints.py b/tests/postgres_tests/test_constraints.py
index ab5bf2bab1..2cc3de5f4d 100644
--- a/tests/postgres_tests/test_constraints.py
+++ b/tests/postgres_tests/test_constraints.py
@@ -309,7 +309,7 @@ class ExclusionConstraintTests(PostgreSQLTestCase):
def test_invalid_expressions(self):
msg = "The expressions must be a list of 2-tuples."
- for expressions in (["foo"], [("foo")], [("foo_1", "foo_2", "foo_3")]):
+ for expressions in (["foo"], ["foo"], [("foo_1", "foo_2", "foo_3")]):
with self.subTest(expressions), self.assertRaisesMessage(ValueError, msg):
ExclusionConstraint(
index_type="GIST",
diff --git a/tests/serializers/test_data.py b/tests/serializers/test_data.py
index bd81ce0c14..6a6de18033 100644
--- a/tests/serializers/test_data.py
+++ b/tests/serializers/test_data.py
@@ -257,7 +257,7 @@ uuid_obj = uuid.uuid4()
test_data = [
# Format: (test helper, PK value, Model Class, data)
- (data_obj, 1, BinaryData, memoryview(b"\x05\xFD\x00")),
+ (data_obj, 1, BinaryData, memoryview(b"\x05\xfd\x00")),
(data_obj, 5, BooleanData, True),
(data_obj, 6, BooleanData, False),
(data_obj, 7, BooleanData, None),
diff --git a/tests/serializers/test_xml.py b/tests/serializers/test_xml.py
index c9df2f2a5b..0ae66f77d0 100644
--- a/tests/serializers/test_xml.py
+++ b/tests/serializers/test_xml.py
@@ -70,7 +70,7 @@ class XmlSerializerTestCase(SerializersTestBase, TestCase):
msg = "Article.headline (pk:%s) contains unserializable characters" % self.a1.pk
with self.assertRaisesMessage(ValueError, msg):
serializers.serialize(self.serializer_name, [self.a1])
- self.a1.headline = "HT \u0009, LF \u000A, and CR \u000D are allowed"
+ self.a1.headline = "HT \u0009, LF \u000a, and CR \u000d are allowed"
self.assertIn(
"HT \t, LF \n, and CR \r are allowed",
serializers.serialize(self.serializer_name, [self.a1]),
diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py
index ab2cfb3f7c..63c7889cbc 100644
--- a/tests/utils_tests/test_text.py
+++ b/tests/utils_tests/test_text.py
@@ -9,7 +9,7 @@ from django.utils.functional import lazystr
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy, override
-IS_WIDE_BUILD = len("\U0001F4A9") == 1
+IS_WIDE_BUILD = len("\U0001f4a9") == 1
class TestUtilsText(SimpleTestCase):
@@ -76,16 +76,16 @@ class TestUtilsText(SimpleTestCase):
# Ensure the final length is calculated correctly when there are
# combining characters with no precomposed form, and that combining
# characters are not split up.
- truncator = text.Truncator("-B\u030AB\u030A----8")
- self.assertEqual("-B\u030A…", truncator.chars(3))
- self.assertEqual("-B\u030AB\u030A-…", truncator.chars(5))
- self.assertEqual("-B\u030AB\u030A----8", truncator.chars(8))
+ truncator = text.Truncator("-B\u030aB\u030a----8")
+ self.assertEqual("-B\u030a…", truncator.chars(3))
+ self.assertEqual("-B\u030aB\u030a-…", truncator.chars(5))
+ self.assertEqual("-B\u030aB\u030a----8", truncator.chars(8))
# Ensure the length of the end text is correctly calculated when it
# contains combining characters with no precomposed form.
truncator = text.Truncator("-----")
- self.assertEqual("---B\u030A", truncator.chars(4, "B\u030A"))
- self.assertEqual("-----", truncator.chars(5, "B\u030A"))
+ self.assertEqual("---B\u030a", truncator.chars(4, "B\u030a"))
+ self.assertEqual("-----", truncator.chars(5, "B\u030a"))
# Make a best effort to shorten to the desired length, but requesting
# a length shorter than the ellipsis shouldn't break