1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Removed unnecessary trailing commas in tests.

This commit is contained in:
konsti 2023-08-22 12:42:57 +02:00 committed by GitHub
parent f1c0a3baf7
commit 48a1929ca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 18 additions and 18 deletions

View File

@ -325,7 +325,7 @@ class UtilsTests(SimpleTestCase):
) )
msg = "Unable to lookup 'nonexistent' on Article or ArticleForm" msg = "Unable to lookup 'nonexistent' on Article or ArticleForm"
with self.assertRaisesMessage(AttributeError, msg): with self.assertRaisesMessage(AttributeError, msg):
label_for_field("nonexistent", Article, form=ArticleForm()), label_for_field("nonexistent", Article, form=ArticleForm())
def test_label_for_property(self): def test_label_for_property(self):
class MockModelAdmin: class MockModelAdmin:

View File

@ -150,12 +150,12 @@ class UserAttributeSimilarityValidatorTest(TestCase):
self.assertIsNone(UserAttributeSimilarityValidator().validate("testclient")) self.assertIsNone(UserAttributeSimilarityValidator().validate("testclient"))
with self.assertRaises(ValidationError) as cm: with self.assertRaises(ValidationError) as cm:
UserAttributeSimilarityValidator().validate("testclient", user=user), UserAttributeSimilarityValidator().validate("testclient", user=user)
self.assertEqual(cm.exception.messages, [expected_error % "username"]) self.assertEqual(cm.exception.messages, [expected_error % "username"])
self.assertEqual(cm.exception.error_list[0].code, "password_too_similar") self.assertEqual(cm.exception.error_list[0].code, "password_too_similar")
with self.assertRaises(ValidationError) as cm: with self.assertRaises(ValidationError) as cm:
UserAttributeSimilarityValidator().validate("example.com", user=user), UserAttributeSimilarityValidator().validate("example.com", user=user)
self.assertEqual(cm.exception.messages, [expected_error % "email address"]) self.assertEqual(cm.exception.messages, [expected_error % "email address"])
with self.assertRaises(ValidationError) as cm: with self.assertRaises(ValidationError) as cm:
@ -193,7 +193,7 @@ class UserAttributeSimilarityValidatorTest(TestCase):
return "foobar" return "foobar"
with self.assertRaises(ValidationError) as cm: with self.assertRaises(ValidationError) as cm:
UserAttributeSimilarityValidator().validate("foobar", user=TestUser()), UserAttributeSimilarityValidator().validate("foobar", user=TestUser())
self.assertEqual( self.assertEqual(
cm.exception.messages, ["The password is too similar to the username."] cm.exception.messages, ["The password is too similar to the username."]
) )

View File

@ -195,7 +195,7 @@ class CustomPKTests(TestCase):
self.assertEqual(f.bar, new_bar) self.assertEqual(f.bar, new_bar)
f = Foo.objects.get(bar=new_bar) f = Foo.objects.get(bar=new_bar)
self.assertEqual(f, new_foo), self.assertEqual(f, new_foo)
self.assertEqual(f.bar, new_bar) self.assertEqual(f.bar, new_bar)
# SQLite lets objects be saved with an empty primary key, even though an # SQLite lets objects be saved with an empty primary key, even though an

View File

@ -94,7 +94,7 @@ class GetStorageClassTests(SimpleTestCase):
def test_deprecation_warning(self): def test_deprecation_warning(self):
msg = GET_STORAGE_CLASS_DEPRECATED_MSG msg = GET_STORAGE_CLASS_DEPRECATED_MSG
with self.assertRaisesMessage(RemovedInDjango51Warning, msg): with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
get_storage_class("django.core.files.storage.FileSystemStorage"), get_storage_class("django.core.files.storage.FileSystemStorage")
class FileSystemStorageTests(unittest.TestCase): class FileSystemStorageTests(unittest.TestCase):

View File

@ -490,5 +490,5 @@ class GenericInlineModelAdminTest(SimpleTestCase):
("media", MediaInline), ("media", MediaInline),
): ):
request.name = name request.name = name
self.assertEqual(ma.get_inlines(request, None), (inline_class,)), self.assertEqual(ma.get_inlines(request, None), (inline_class,))
self.assertEqual(type(ma.get_inline_instances(request)[0]), inline_class) self.assertEqual(type(ma.get_inline_instances(request)[0]), inline_class)

View File

@ -17,7 +17,7 @@ class GeoJSONSerializerTests(TestCase):
all_formats = set(serializers.get_serializer_formats()) all_formats = set(serializers.get_serializer_formats())
public_formats = set(serializers.get_public_serializer_formats()) public_formats = set(serializers.get_public_serializer_formats())
self.assertIn("geojson", all_formats), self.assertIn("geojson", all_formats)
self.assertIn("geojson", public_formats) self.assertIn("geojson", public_formats)
def test_serialization_base(self): def test_serialization_base(self):

View File

@ -660,8 +660,8 @@ class GeoQuerySetTest(TestCase):
# flaky. # flaky.
for point, ref_city in zip(sorted(line), sorted(ref_points)): for point, ref_city in zip(sorted(line), sorted(ref_points)):
point_x, point_y = point point_x, point_y = point
self.assertAlmostEqual(point_x, ref_city.x, 5), self.assertAlmostEqual(point_x, ref_city.x, 5)
self.assertAlmostEqual(point_y, ref_city.y, 5), self.assertAlmostEqual(point_y, ref_city.y, 5)
@skipUnlessDBFeature("supports_union_aggr") @skipUnlessDBFeature("supports_union_aggr")
def test_unionagg(self): def test_unionagg(self):

View File

@ -73,7 +73,7 @@ class SerializerRegistrationTests(SimpleTestCase):
all_formats = set(serializers.get_serializer_formats()) all_formats = set(serializers.get_serializer_formats())
public_formats = set(serializers.get_public_serializer_formats()) public_formats = set(serializers.get_public_serializer_formats())
self.assertIn("xml", all_formats), self.assertIn("xml", all_formats)
self.assertIn("xml", public_formats) self.assertIn("xml", public_formats)
self.assertIn("json2", all_formats) self.assertIn("json2", all_formats)

View File

@ -158,7 +158,7 @@ class FunctionTests(SimpleTestCase):
) )
def test_word_with_dot(self): def test_word_with_dot(self):
self.assertEqual(urlize("some.organization"), "some.organization"), self.assertEqual(urlize("some.organization"), "some.organization")
def test_https(self): def test_https(self):
self.assertEqual( self.assertEqual(

View File

@ -21,9 +21,9 @@ class CustomOptionsTestRunner(DiscoverRunner):
@classmethod @classmethod
def add_arguments(cls, parser): def add_arguments(cls, parser):
parser.add_argument("--option_a", "-a", default="1"), parser.add_argument("--option_a", "-a", default="1")
parser.add_argument("--option_b", "-b", default="2"), parser.add_argument("--option_b", "-b", default="2")
parser.add_argument("--option_c", "-c", default="3"), parser.add_argument("--option_c", "-c", default="3")
def run_tests(self, test_labels, **kwargs): def run_tests(self, test_labels, **kwargs):
print("%s:%s:%s" % (self.option_a, self.option_b, self.option_c)) print("%s:%s:%s" % (self.option_a, self.option_b, self.option_c))

View File

@ -61,9 +61,9 @@ class TestUtilsText(SimpleTestCase):
self.assertEqual( self.assertEqual(
"The quick brown fox jumped over the lazy dog.", truncator.chars(100) "The quick brown fox jumped over the lazy dog.", truncator.chars(100)
), ),
self.assertEqual("The quick brown fox …", truncator.chars(21)), self.assertEqual("The quick brown fox …", truncator.chars(21))
self.assertEqual("The quick brown fo.....", truncator.chars(23, ".....")), self.assertEqual("The quick brown fo.....", truncator.chars(23, "....."))
self.assertEqual(".....", truncator.chars(4, ".....")), self.assertEqual(".....", truncator.chars(4, "....."))
nfc = text.Truncator("o\xfco\xfco\xfco\xfc") nfc = text.Truncator("o\xfco\xfco\xfco\xfc")
nfd = text.Truncator("ou\u0308ou\u0308ou\u0308ou\u0308") nfd = text.Truncator("ou\u0308ou\u0308ou\u0308ou\u0308")