mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Removed unnecessary trailing commas and spaces in various code.
This commit is contained in:
parent
058d112ed2
commit
83a36ac49a
@ -249,7 +249,7 @@ class DeleteModel(ModelOperation):
|
||||
schema_editor.create_model(model)
|
||||
|
||||
def describe(self):
|
||||
return "Delete model %s" % (self.name, )
|
||||
return "Delete model %s" % self.name
|
||||
|
||||
|
||||
class RenameModel(ModelOperation):
|
||||
@ -701,7 +701,7 @@ class AlterModelOptions(ModelOptionOperation):
|
||||
pass
|
||||
|
||||
def describe(self):
|
||||
return "Change Meta options on %s" % (self.name, )
|
||||
return "Change Meta options on %s" % self.name
|
||||
|
||||
|
||||
class AlterModelManagers(ModelOptionOperation):
|
||||
@ -732,7 +732,7 @@ class AlterModelManagers(ModelOptionOperation):
|
||||
pass
|
||||
|
||||
def describe(self):
|
||||
return "Change managers on %s" % (self.name, )
|
||||
return "Change managers on %s" % self.name
|
||||
|
||||
|
||||
class IndexOperation(Operation):
|
||||
|
@ -284,7 +284,7 @@ man_pages = [(
|
||||
'Utility script for the Django Web framework',
|
||||
['Django Software Foundation'],
|
||||
1
|
||||
), ]
|
||||
)]
|
||||
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
|
@ -1029,7 +1029,7 @@ attributes. Thus, you can subclass the appropriate feed generator class
|
||||
.. _georss: http://georss.org/
|
||||
.. _itunes podcast format: https://www.apple.com/itunes/podcasts/specs.html
|
||||
|
||||
``SyndicationFeed.root_attributes(self, )``
|
||||
``SyndicationFeed.root_attributes(self)``
|
||||
Return a ``dict`` of attributes to add to the root feed element
|
||||
(``feed``/``channel``).
|
||||
|
||||
|
@ -229,15 +229,15 @@ class EmployeeAdmin(ModelAdmin):
|
||||
|
||||
|
||||
class DepartmentFilterEmployeeAdmin(EmployeeAdmin):
|
||||
list_filter = [DepartmentListFilterLookupWithNonStringValue, ]
|
||||
list_filter = [DepartmentListFilterLookupWithNonStringValue]
|
||||
|
||||
|
||||
class DepartmentFilterUnderscoredEmployeeAdmin(EmployeeAdmin):
|
||||
list_filter = [DepartmentListFilterLookupWithUnderscoredParameter, ]
|
||||
list_filter = [DepartmentListFilterLookupWithUnderscoredParameter]
|
||||
|
||||
|
||||
class DepartmentFilterDynamicValueBookAdmin(EmployeeAdmin):
|
||||
list_filter = [DepartmentListFilterLookupWithDynamicValue, ]
|
||||
list_filter = [DepartmentListFilterLookupWithDynamicValue]
|
||||
|
||||
|
||||
class BookmarkAdminGenericRelation(ModelAdmin):
|
||||
|
@ -748,7 +748,7 @@ def callable_on_unknown(obj):
|
||||
|
||||
|
||||
class AttributeErrorRaisingAdmin(admin.ModelAdmin):
|
||||
list_display = [callable_on_unknown, ]
|
||||
list_display = [callable_on_unknown]
|
||||
|
||||
|
||||
class CustomManagerAdmin(admin.ModelAdmin):
|
||||
|
@ -518,6 +518,6 @@ class CheckAllowedHostsTest(SimpleTestCase):
|
||||
def test_allowed_hosts_empty(self):
|
||||
self.assertEqual(self.func(None), [base.W020])
|
||||
|
||||
@override_settings(ALLOWED_HOSTS=['.example.com', ])
|
||||
@override_settings(ALLOWED_HOSTS=['.example.com'])
|
||||
def test_allowed_hosts_set(self):
|
||||
self.assertEqual(self.func(None), [])
|
||||
|
@ -30,10 +30,10 @@ class SystemCheckFrameworkTests(SimpleTestCase):
|
||||
return [1, 2, 3]
|
||||
|
||||
def f2(**kwargs):
|
||||
return [4, ]
|
||||
return [4]
|
||||
|
||||
def f3(**kwargs):
|
||||
return [5, ]
|
||||
return [5]
|
||||
|
||||
calls = [0]
|
||||
|
||||
|
@ -6,7 +6,7 @@ from django.test import TestCase, modify_settings, override_settings
|
||||
from django.utils import translation
|
||||
|
||||
|
||||
@modify_settings(INSTALLED_APPS={'append': ['django.contrib.flatpages', ]})
|
||||
@modify_settings(INSTALLED_APPS={'append': ['django.contrib.flatpages']})
|
||||
@override_settings(SITE_ID=1)
|
||||
class FlatpageAdminFormTests(TestCase):
|
||||
|
||||
|
@ -256,7 +256,7 @@ class GDALRasterTests(SimpleTestCase):
|
||||
if numpy:
|
||||
result = result.flatten().tolist()
|
||||
# All band data is equal to nodata value.
|
||||
self.assertEqual(result, [23, ] * 4)
|
||||
self.assertEqual(result, [23] * 4)
|
||||
|
||||
def test_set_nodata_none_on_raster_creation(self):
|
||||
if GDAL_VERSION < (2, 1):
|
||||
@ -299,7 +299,7 @@ class GDALRasterTests(SimpleTestCase):
|
||||
})
|
||||
# Set metadata on raster and on a band.
|
||||
metadata = {
|
||||
'DEFAULT': {'OWNER': 'Django', 'VERSION': '1.0', 'AREA_OR_POINT': 'Point', },
|
||||
'DEFAULT': {'OWNER': 'Django', 'VERSION': '1.0', 'AREA_OR_POINT': 'Point'},
|
||||
}
|
||||
source.metadata = metadata
|
||||
source.bands[0].metadata = metadata
|
||||
@ -307,13 +307,13 @@ class GDALRasterTests(SimpleTestCase):
|
||||
self.assertEqual(source.bands[0].metadata['DEFAULT'], metadata['DEFAULT'])
|
||||
# Update metadata on raster.
|
||||
metadata = {
|
||||
'DEFAULT': {'VERSION': '2.0', },
|
||||
'DEFAULT': {'VERSION': '2.0'},
|
||||
}
|
||||
source.metadata = metadata
|
||||
self.assertEqual(source.metadata['DEFAULT']['VERSION'], '2.0')
|
||||
# Remove metadata on raster.
|
||||
metadata = {
|
||||
'DEFAULT': {'OWNER': None, },
|
||||
'DEFAULT': {'OWNER': None},
|
||||
}
|
||||
source.metadata = metadata
|
||||
self.assertNotIn('OWNER', source.metadata['DEFAULT'])
|
||||
|
@ -1264,7 +1264,7 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
|
||||
mp = MultiPolygon(p1, p2)
|
||||
path, args, kwargs = mp.deconstruct()
|
||||
self.assertEqual(path, 'django.contrib.gis.geos.collections.MultiPolygon')
|
||||
self.assertEqual(args, (p1, p2, ))
|
||||
self.assertEqual(args, (p1, p2))
|
||||
self.assertEqual(kwargs, {})
|
||||
|
||||
poly = Polygon(((0, 0), (0, 1), (1, 1), (0, 0)))
|
||||
|
@ -1142,7 +1142,7 @@ class MiscTests(SimpleTestCase):
|
||||
('en; q=1.0, * ; q=0.5', [('en', 1.0), ('*', 0.5)]),
|
||||
# Bad headers
|
||||
('en-gb;q=1.0000', []),
|
||||
('en;q=0.1234', [], ),
|
||||
('en;q=0.1234', []),
|
||||
('en;q=.2', []),
|
||||
('abcdefghi-au', []),
|
||||
('**', []),
|
||||
|
@ -87,7 +87,7 @@ class M2mThroughTests(TestCase):
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
self.rock.members.all(),
|
||||
['Jim', ],
|
||||
['Jim'],
|
||||
attrgetter("name")
|
||||
)
|
||||
|
||||
@ -156,7 +156,7 @@ class M2mThroughTests(TestCase):
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
self.bob.group_set.all(),
|
||||
['Rock', ],
|
||||
['Rock'],
|
||||
attrgetter('name')
|
||||
)
|
||||
|
||||
@ -192,7 +192,7 @@ class M2mThroughTests(TestCase):
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
Group.objects.filter(members__name='Bob'),
|
||||
['Roll', ],
|
||||
['Roll'],
|
||||
attrgetter("name")
|
||||
)
|
||||
|
||||
|
@ -147,7 +147,7 @@ class GraphTests(SimpleTestCase):
|
||||
graph.add_dependency("app_b.0001", ("app_b", "0001"), ("app_a", "0003"))
|
||||
# Test whole graph
|
||||
with self.assertRaises(CircularDependencyError):
|
||||
graph.forwards_plan(("app_a", "0003"), )
|
||||
graph.forwards_plan(("app_a", "0003"))
|
||||
|
||||
def test_circular_graph_2(self):
|
||||
graph = MigrationGraph()
|
||||
|
@ -291,7 +291,7 @@ class FormsetTests(TestCase):
|
||||
data = {'test-TOTAL_FORMS': '1',
|
||||
'test-INITIAL_FORMS': '0',
|
||||
'test-MAX_NUM_FORMS': '',
|
||||
'test-0-name': 'Random Place', }
|
||||
'test-0-name': 'Random Place'}
|
||||
with self.assertNumQueries(1):
|
||||
formset = Formset(data, prefix="test")
|
||||
formset.save()
|
||||
|
@ -625,7 +625,7 @@ class ListFilterTests(CheckTestCase):
|
||||
return 'awesomeness'
|
||||
|
||||
def get_choices(self, request):
|
||||
return (('bit', 'A bit awesome'), ('very', 'Very awesome'), )
|
||||
return (('bit', 'A bit awesome'), ('very', 'Very awesome'))
|
||||
|
||||
def get_queryset(self, cl, qs):
|
||||
return qs
|
||||
@ -655,7 +655,7 @@ class ListFilterTests(CheckTestCase):
|
||||
return 'awesomeness'
|
||||
|
||||
def get_choices(self, request):
|
||||
return (('bit', 'A bit awesome'), ('very', 'Very awesome'), )
|
||||
return (('bit', 'A bit awesome'), ('very', 'Very awesome'))
|
||||
|
||||
def get_queryset(self, cl, qs):
|
||||
return qs
|
||||
|
@ -18,10 +18,10 @@ class Article(models.Model):
|
||||
author = models.ForeignKey(Author, models.SET_NULL, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return 'Article titled: %s' % (self.title, )
|
||||
return 'Article titled: %s' % self.title
|
||||
|
||||
class Meta:
|
||||
ordering = ['author__name', ]
|
||||
ordering = ['author__name']
|
||||
|
||||
|
||||
# These following 4 models represent a far more complex ordering case.
|
||||
|
@ -2351,11 +2351,11 @@ class QuerySetSupportsPythonIdioms(TestCase):
|
||||
|
||||
def test_slicing_cannot_filter_queryset_once_sliced(self):
|
||||
with self.assertRaisesMessage(AssertionError, "Cannot filter a query once a slice has been taken."):
|
||||
Article.objects.all()[0:5].filter(id=1, )
|
||||
Article.objects.all()[0:5].filter(id=1)
|
||||
|
||||
def test_slicing_cannot_reorder_queryset_once_sliced(self):
|
||||
with self.assertRaisesMessage(AssertionError, "Cannot reorder a query once a slice has been taken."):
|
||||
Article.objects.all()[0:5].order_by('id', )
|
||||
Article.objects.all()[0:5].order_by('id')
|
||||
|
||||
def test_slicing_cannot_combine_queries_once_sliced(self):
|
||||
with self.assertRaisesMessage(AssertionError, "Cannot combine queries once a slice has been taken."):
|
||||
@ -3581,7 +3581,7 @@ class RelatedLookupTypeTests(TestCase):
|
||||
When passing proxy model objects, child objects, or parent objects,
|
||||
lookups work fine.
|
||||
"""
|
||||
out_a = ['<ObjectA: oa>', ]
|
||||
out_a = ['<ObjectA: oa>']
|
||||
out_b = ['<ObjectB: ob>', '<ObjectB: pob>']
|
||||
out_c = ['<ObjectC: >']
|
||||
|
||||
|
@ -28,7 +28,7 @@ class GetUniqueCheckTests(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
([(UniqueTogetherModel, ('ifield', 'cfield')),
|
||||
(UniqueTogetherModel, ('ifield', 'efield')),
|
||||
(UniqueTogetherModel, ('id',)), ],
|
||||
(UniqueTogetherModel, ('id',))],
|
||||
[]),
|
||||
m._get_unique_checks()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user