Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed E225 pep8 warnings.

  • Loading branch information...
commit ae48d77ef8e14dae76fddcd5a677b897c7c7c4ae 1 parent 51d2e1f
Tim Graham timgraham authored
Showing with 103 additions and 92 deletions.
  1. +1 −1  django/contrib/gis/db/backends/postgis/operations.py
  2. +1 −1  django/contrib/gis/db/models/proxy.py
  3. +1 −1  django/contrib/gis/gdal/geomtype.py
  4. +1 −1  django/contrib/gis/gdal/prototypes/srs.py
  5. +1 −1  django/contrib/gis/geos/linestring.py
  6. +1 −1  django/contrib/gis/geos/prototypes/prepared.py
  7. +1 −1  django/contrib/gis/maps/google/gmap.py
  8. +2 −2 django/contrib/gis/maps/google/overlays.py
  9. +1 −1  django/contrib/gis/maps/google/zoom.py
  10. +7 −7 django/contrib/gis/tests/test_geoforms.py
  11. +1 −1  django/contrib/gis/tests/test_measure.py
  12. +6 −6 django/contrib/messages/tests/base.py
  13. +1 −1  django/contrib/redirects/models.py
  14. +1 −1  django/contrib/sites/managers.py
  15. +1 −1  django/core/management/commands/makemessages.py
  16. +1 −1  django/dispatch/saferef.py
  17. +1 −1  django/forms/widgets.py
  18. +1 −1  django/utils/datastructures.py
  19. +1 −1  django/utils/dateformat.py
  20. +1 −1  django/utils/datetime_safe.py
  21. +1 −1  docs/conf.py
  22. +1 −1  setup.cfg
  23. +2 −2 tests/admin_inlines/admin.py
  24. +1 −1  tests/admin_validation/tests.py
  25. +3 −3 tests/admin_views/admin.py
  26. +1 −1  tests/admin_widgets/tests.py
  27. +2 −2 tests/backends/tests.py
  28. +2 −2 tests/cache/tests.py
  29. +1 −1  tests/defer/models.py
  30. +1 −1  tests/dispatch/tests/test_saferef.py
  31. +2 −2 tests/distinct_on_fields/tests.py
  32. +6 −6 tests/expressions_regress/tests.py
  33. +14 −3 tests/forms_tests/tests/test_widgets.py
  34. +6 −6 tests/i18n/commands/compilation.py
  35. +4 −4 tests/i18n/commands/extraction.py
  36. +2 −2 tests/m2m_and_m2o/tests.py
  37. +1 −1  tests/m2m_through_regress/tests.py
  38. +1 −1  tests/model_forms/tests.py
  39. +1 −1  tests/model_inheritance_regress/tests.py
  40. +3 −3 tests/multiple_database/tests.py
  41. +3 −3 tests/queries/tests.py
  42. +12 −12 tests/select_related_regress/tests.py
  43. +1 −1  tests/validation/tests.py
2  django/contrib/gis/db/backends/postgis/operations.py
View
@@ -456,7 +456,7 @@ def num_params(self, lookup_type, num_param):
def exactly_two(np):
return np == 2
def two_to_three(np):
- return np >= 2 and np <=3
+ return np >= 2 and np <= 3
if (lookup_type in self.distance_functions and
lookup_type != 'dwithin'):
return two_to_three(num_param)
2  django/contrib/gis/db/models/proxy.py
View
@@ -32,7 +32,7 @@ class specified during initialization and the HEXEWKB value of the field.
if isinstance(geom_value, self._klass):
geom = geom_value
- elif (geom_value is None) or (geom_value==''):
+ elif (geom_value is None) or (geom_value == ''):
geom = None
else:
# Otherwise, a Geometry object is built using the field's contents,
2  django/contrib/gis/gdal/geomtype.py
View
@@ -37,7 +37,7 @@ def __init__(self, type_input):
elif isinstance(type_input, six.string_types):
type_input = type_input.lower()
if type_input == 'geometry':
- type_input='unknown'
+ type_input = 'unknown'
num = self._str_types.get(type_input, None)
if num is None:
raise OGRException('Invalid OGR String Type "%s"' % type_input)
2  django/contrib/gis/gdal/prototypes/srs.py
View
@@ -67,5 +67,5 @@ def units_func(f):
isprojected = int_output(lgdal.OSRIsProjected, [c_void_p])
# Coordinate transformation
-new_ct= srs_output(std_call('OCTNewCoordinateTransformation'), [c_void_p, c_void_p])
+new_ct = srs_output(std_call('OCTNewCoordinateTransformation'), [c_void_p, c_void_p])
destroy_ct = void_output(std_call('OCTDestroyCoordinateTransformation'), [c_void_p], errcheck=False)
2  django/contrib/gis/geos/linestring.py
View
@@ -58,7 +58,7 @@ def __init__(self, *args, **kwargs):
# Creating a coordinate sequence object because it is easier to
# set the points using GEOSCoordSeq.__setitem__().
- cs = GEOSCoordSeq(capi.create_cs(ncoords, ndim), z=bool(ndim==3))
+ cs = GEOSCoordSeq(capi.create_cs(ncoords, ndim), z=bool(ndim == 3))
for i in xrange(ncoords):
if numpy_coords:
2  django/contrib/gis/geos/prototypes/prepared.py
View
@@ -14,7 +14,7 @@
# Prepared geometry binary predicate support.
def prepared_predicate(func):
- func.argtypes= [PREPGEOM_PTR, GEOM_PTR]
+ func.argtypes = [PREPGEOM_PTR, GEOM_PTR]
func.restype = c_char
func.errcheck = check_predicate
return func
2  django/contrib/gis/maps/google/gmap.py
View
@@ -12,7 +12,7 @@ class GoogleMapException(Exception):
# The default Google Maps URL (for the API javascript)
# TODO: Internationalize for Japan, UK, etc.
-GOOGLE_MAPS_URL='http://maps.google.com/maps?file=api&v=%s&key='
+GOOGLE_MAPS_URL = 'http://maps.google.com/maps?file=api&v=%s&key='
class GoogleMap(object):
4 django/contrib/gis/maps/google/overlays.py
View
@@ -52,7 +52,7 @@ def __init__(self, event, action):
def __str__(self):
"Returns the parameter part of a GEvent."
- return mark_safe('"%s", %s' %(self.event, self.action))
+ return mark_safe('"%s", %s' % (self.event, self.action))
@python_2_unicode_compatible
class GOverlayBase(object):
@@ -303,7 +303,7 @@ def __init__(self, geom, title=None, draggable=False, icon=None):
super(GMarker, self).__init__()
def latlng_from_coords(self, coords):
- return 'new GLatLng(%s,%s)' %(coords[1], coords[0])
+ return 'new GLatLng(%s,%s)' % (coords[1], coords[0])
def options(self):
result = []
2  django/contrib/gis/maps/google/zoom.py
View
@@ -95,7 +95,7 @@ def pixel_to_lonlat(self, px, zoom):
lon = (px[0] - npix) / self._degpp[zoom]
# Calculating the latitude value.
- lat = RTOD * (2 * atan(exp((px[1] - npix)/ (-1.0 * self._radpp[zoom]))) - 0.5 * pi)
+ lat = RTOD * (2 * atan(exp((px[1] - npix) / (-1.0 * self._radpp[zoom]))) - 0.5 * pi)
# Returning the longitude, latitude coordinate pair.
return (lon, lat)
14 django/contrib/gis/tests/test_geoforms.py
View
@@ -163,7 +163,7 @@ class PointForm(forms.Form):
self.assertFalse(invalid.is_valid())
self.assertTrue('Invalid geometry value' in str(invalid.errors))
- for invalid in [geo for key, geo in self.geometries.items() if key!='point']:
+ for invalid in [geo for key, geo in self.geometries.items() if key != 'point']:
self.assertFalse(PointForm(data={'p': invalid.wkt}).is_valid())
def test_multipointfield(self):
@@ -176,7 +176,7 @@ class PointForm(forms.Form):
self.assertMapWidget(form)
self.assertFalse(PointForm().is_valid())
- for invalid in [geo for key, geo in self.geometries.items() if key!='multipoint']:
+ for invalid in [geo for key, geo in self.geometries.items() if key != 'multipoint']:
self.assertFalse(PointForm(data={'p': invalid.wkt}).is_valid())
def test_linestringfield(self):
@@ -189,7 +189,7 @@ class LineStringForm(forms.Form):
self.assertMapWidget(form)
self.assertFalse(LineStringForm().is_valid())
- for invalid in [geo for key, geo in self.geometries.items() if key!='linestring']:
+ for invalid in [geo for key, geo in self.geometries.items() if key != 'linestring']:
self.assertFalse(LineStringForm(data={'p': invalid.wkt}).is_valid())
def test_multilinestringfield(self):
@@ -202,7 +202,7 @@ class LineStringForm(forms.Form):
self.assertMapWidget(form)
self.assertFalse(LineStringForm().is_valid())
- for invalid in [geo for key, geo in self.geometries.items() if key!='multilinestring']:
+ for invalid in [geo for key, geo in self.geometries.items() if key != 'multilinestring']:
self.assertFalse(LineStringForm(data={'p': invalid.wkt}).is_valid())
def test_polygonfield(self):
@@ -215,7 +215,7 @@ class PolygonForm(forms.Form):
self.assertMapWidget(form)
self.assertFalse(PolygonForm().is_valid())
- for invalid in [geo for key, geo in self.geometries.items() if key!='polygon']:
+ for invalid in [geo for key, geo in self.geometries.items() if key != 'polygon']:
self.assertFalse(PolygonForm(data={'p': invalid.wkt}).is_valid())
def test_multipolygonfield(self):
@@ -228,7 +228,7 @@ class PolygonForm(forms.Form):
self.assertMapWidget(form)
self.assertFalse(PolygonForm().is_valid())
- for invalid in [geo for key, geo in self.geometries.items() if key!='multipolygon']:
+ for invalid in [geo for key, geo in self.geometries.items() if key != 'multipolygon']:
self.assertFalse(PolygonForm(data={'p': invalid.wkt}).is_valid())
def test_geometrycollectionfield(self):
@@ -241,7 +241,7 @@ class GeometryForm(forms.Form):
self.assertMapWidget(form)
self.assertFalse(GeometryForm().is_valid())
- for invalid in [geo for key, geo in self.geometries.items() if key!='geometrycollection']:
+ for invalid in [geo for key, geo in self.geometries.items() if key != 'geometrycollection']:
self.assertFalse(GeometryForm(data={'g': invalid.wkt}).is_valid())
def test_osm_widget(self):
2  django/contrib/gis/tests/test_measure.py
View
@@ -272,5 +272,5 @@ def suite():
def run(verbosity=2):
unittest.TextTestRunner(verbosity=verbosity).run(suite())
-if __name__=="__main__":
+if __name__ == "__main__":
run()
12 django/contrib/messages/tests/base.py
View
@@ -214,11 +214,11 @@ def test_multiple_posts(self):
@override_settings(
INSTALLED_APPS=filter(
- lambda app:app!='django.contrib.messages', settings.INSTALLED_APPS),
+ lambda app: app != 'django.contrib.messages', settings.INSTALLED_APPS),
MIDDLEWARE_CLASSES=filter(
- lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
+ lambda m: 'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter(
- lambda p:'context_processors.messages' not in p,
+ lambda p: 'context_processors.messages' not in p,
settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG
)
@@ -239,11 +239,11 @@ def test_middleware_disabled(self):
@override_settings(
INSTALLED_APPS=filter(
- lambda app:app!='django.contrib.messages', settings.INSTALLED_APPS),
+ lambda app: app != 'django.contrib.messages', settings.INSTALLED_APPS),
MIDDLEWARE_CLASSES=filter(
- lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
+ lambda m: 'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter(
- lambda p:'context_processors.messages' not in p,
+ lambda p: 'context_processors.messages' not in p,
settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG
)
2  django/contrib/redirects/models.py
View
@@ -15,7 +15,7 @@ class Meta:
verbose_name = _('redirect')
verbose_name_plural = _('redirects')
db_table = 'django_redirect'
- unique_together=(('site', 'old_path'),)
+ unique_together = (('site', 'old_path'),)
ordering = ('old_path',)
def __str__(self):
2  django/contrib/sites/managers.py
View
@@ -29,7 +29,7 @@ def _validate_field_name(self):
try:
field = self.model._meta.get_field(self.__field_name)
if not isinstance(field, (models.ForeignKey, models.ManyToManyField)):
- raise TypeError("%s must be a ForeignKey or ManyToManyField." %self.__field_name)
+ raise TypeError("%s must be a ForeignKey or ManyToManyField." % self.__field_name)
except FieldDoesNotExist:
raise ValueError("%s couldn't find a field named %s in %s." %
(self.__class__.__name__, self.__field_name, self.model._meta.object_name))
2  django/core/management/commands/makemessages.py
View
@@ -138,7 +138,7 @@ def process(self, command, potfile, domain, keep_pot=False):
if msgs:
if is_templatized:
# Remove '.py' suffix
- if os.name =='nt':
+ if os.name == 'nt':
# Preserve '.\' prefix on Windows to respect gettext behavior
old = '#: ' + work_file
new = '#: ' + orig_file
2  django/dispatch/saferef.py
View
@@ -83,7 +83,7 @@ def __new__(cls, target, onDelete=None, *arguments,**named):
of already-referenced methods.
"""
key = cls.calculateKey(target)
- current =cls._allInstances.get(key)
+ current = cls._allInstances.get(key)
if current is not None:
current.deletionMethods.append(onDelete)
return current
2  django/forms/widgets.py
View
@@ -274,7 +274,7 @@ def __init__(self, attrs=None, render_value=False):
def render(self, name, value, attrs=None):
if not self.render_value:
- value=None
+ value = None
return super(PasswordInput, self).render(name, value, attrs)
class HiddenInput(Input):
2  django/utils/datastructures.py
View
@@ -500,7 +500,7 @@ def complain(self, *wargs, **kwargs):
extend = complain
insert = complain
pop = complain
- remove= complain
+ remove = complain
sort = complain
reverse = complain
2  django/utils/dateformat.py
View
@@ -170,7 +170,7 @@ def T(self):
def u(self):
"Microseconds; i.e. '000000' to '999999'"
- return '%06d' %self.data.microsecond
+ return '%06d' % self.data.microsecond
def Z(self):
"""
2  django/utils/datetime_safe.py
View
@@ -54,7 +54,7 @@ def _findall(text, substr):
if j == -1:
break
sites.append(j)
- i=j+1
+ i = j + 1
return sites
def strftime(dt, fmt):
2  docs/conf.py
View
@@ -264,7 +264,7 @@ def django_release():
# List of tuples (startdocname, targetname, title, author, dir_entry,
# description, category, toctree_only)
-texinfo_documents=[(
+texinfo_documents = [(
master_doc, "django", "", "", "Django",
"Documentation of the Django framework", "Web development", False
)]
2  setup.cfg
View
@@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
[flake8]
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py
-ignore=E124,E125,E127,E128,E225,E226,E241,E251,E302,E501,E203,E231,E261,E301,F401,F403,W601
+ignore=E124,E125,E127,E128,E226,E241,E251,E302,E501,E203,E231,E261,E301,F401,F403,W601
[metadata]
license-file = LICENSE
4 tests/admin_inlines/admin.py
View
@@ -107,7 +107,7 @@ class InlineWeakness(admin.TabularInline):
class QuestionInline(admin.TabularInline):
model = Question
- readonly_fields=['call_me']
+ readonly_fields = ['call_me']
def call_me(self, obj):
return 'Callable in QuestionInline'
@@ -122,7 +122,7 @@ def call_me(self, obj):
class ChapterInline(admin.TabularInline):
model = Chapter
- readonly_fields=['call_me']
+ readonly_fields = ['call_me']
def call_me(self, obj):
return 'Callable in ChapterInline'
2  tests/admin_validation/tests.py
View
@@ -193,7 +193,7 @@ class SongAdmin(admin.ModelAdmin):
def test_nonexistant_field_on_inline(self):
class CityInline(admin.TabularInline):
model = City
- readonly_fields=['i_dont_exist'] # Missing attribute
+ readonly_fields = ['i_dont_exist'] # Missing attribute
self.assertRaisesMessage(ImproperlyConfigured,
str_prefix("CityInline.readonly_fields[0], %(_)s'i_dont_exist' is not a callable "
6 tests/admin_views/admin.py
View
@@ -47,7 +47,7 @@ class ArticleInline(admin.TabularInline):
prepopulated_fields = {
'title' : ('content',)
}
- fieldsets=(
+ fieldsets = (
('Some fields', {
'classes': ('collapse',),
'fields': ('title', 'content')
@@ -74,7 +74,7 @@ class ChapterXtra1Admin(admin.ModelAdmin):
class ArticleAdmin(admin.ModelAdmin):
list_display = ('content', 'date', callable_year, 'model_year', 'modeladmin_year')
list_filter = ('date', 'section')
- fieldsets=(
+ fieldsets = (
('Some fields', {
'classes': ('collapse',),
'fields': ('title', 'content')
@@ -465,7 +465,7 @@ class WorkHourAdmin(admin.ModelAdmin):
class FoodDeliveryAdmin(admin.ModelAdmin):
- list_display=('reference', 'driver', 'restaurant')
+ list_display = ('reference', 'driver', 'restaurant')
list_editable = ('driver', 'restaurant')
2  tests/admin_widgets/tests.py
View
@@ -166,7 +166,7 @@ def testInheritance(self):
def test_m2m_widgets(self):
"""m2m fields help text as it applies to admin app (#9321)."""
class AdvisorAdmin(admin.ModelAdmin):
- filter_vertical=['companies']
+ filter_vertical = ['companies']
self.assertFormfield(models.Advisor, 'companies', widgets.FilteredSelectMultiple,
filter_vertical=['companies'])
4 tests/backends/tests.py
View
@@ -496,9 +496,9 @@ def create_squares(self, args, paramstyle, multiple):
tbl = connection.introspection.table_name_converter(opts.db_table)
f1 = connection.ops.quote_name(opts.get_field('root').column)
f2 = connection.ops.quote_name(opts.get_field('square').column)
- if paramstyle=='format':
+ if paramstyle == 'format':
query = 'INSERT INTO %s (%s, %s) VALUES (%%s, %%s)' % (tbl, f1, f2)
- elif paramstyle=='pyformat':
+ elif paramstyle == 'pyformat':
query = 'INSERT INTO %s (%s, %s) VALUES (%%(root)s, %%(square)s)' % (tbl, f1, f2)
else:
raise ValueError("unsupported paramstyle in test")
4 tests/cache/tests.py
View
@@ -1527,8 +1527,8 @@ def set_cache(request, lang, msg):
self.assertEqual(get_cache_data, None)
# i18n tests
- en_message ="Hello world!"
- es_message ="Hola mundo!"
+ en_message = "Hello world!"
+ es_message = "Hola mundo!"
request = self._get_request_cache()
set_cache(request, 'en', en_message)
2  tests/defer/models.py
View
@@ -27,4 +27,4 @@ class BigChild(Primary):
class ChildProxy(Child):
class Meta:
- proxy=True
+ proxy = True
2  tests/dispatch/tests/test_saferef.py
View
@@ -69,4 +69,4 @@ def testRepresentation(self):
def _closure(self, ref):
"""Dumb utility mechanism to increment deletion counter"""
- self.closureCount +=1
+ self.closureCount += 1
4 tests/distinct_on_fields/tests.py
View
@@ -57,8 +57,8 @@ def test_basic_distinct_on(self):
# Does combining querysets work?
(
(Celebrity.objects.filter(fan__in=[self.fan1, self.fan2]).
- distinct('name').order_by('name')
- |Celebrity.objects.filter(fan__in=[self.fan3]).
+ distinct('name').order_by('name') |
+ Celebrity.objects.filter(fan__in=[self.fan3]).
distinct('name').order_by('name')),
['<Celebrity: c1>', '<Celebrity: c2>'],
),
12 tests/expressions_regress/tests.py
View
@@ -224,7 +224,7 @@ def setUp(self):
e0 = Experiment.objects.create(name='e0', assigned=sday, start=stime,
end=end, completed=end.date())
self.deltas.append(delta0)
- self.delays.append(e0.start-
+ self.delays.append(e0.start -
datetime.datetime.combine(e0.assigned, midnight))
self.days_long.append(e0.completed-e0.assigned)
@@ -239,7 +239,7 @@ def setUp(self):
e1 = Experiment.objects.create(name='e1', assigned=sday,
start=stime+delay, end=end, completed=end.date())
self.deltas.append(delta1)
- self.delays.append(e1.start-
+ self.delays.append(e1.start -
datetime.datetime.combine(e1.assigned, midnight))
self.days_long.append(e1.completed-e1.assigned)
@@ -249,7 +249,7 @@ def setUp(self):
assigned=sday-datetime.timedelta(3), start=stime, end=end,
completed=end.date())
self.deltas.append(delta2)
- self.delays.append(e2.start-
+ self.delays.append(e2.start -
datetime.datetime.combine(e2.assigned, midnight))
self.days_long.append(e2.completed-e2.assigned)
@@ -259,7 +259,7 @@ def setUp(self):
e3 = Experiment.objects.create(name='e3',
assigned=sday, start=stime+delay, end=end, completed=end.date())
self.deltas.append(delta3)
- self.delays.append(e3.start-
+ self.delays.append(e3.start -
datetime.datetime.combine(e3.assigned, midnight))
self.days_long.append(e3.completed-e3.assigned)
@@ -269,7 +269,7 @@ def setUp(self):
assigned=sday-datetime.timedelta(10), start=stime, end=end,
completed=end.date())
self.deltas.append(delta4)
- self.delays.append(e4.start-
+ self.delays.append(e4.start -
datetime.datetime.combine(e4.assigned, midnight))
self.days_long.append(e4.completed-e4.assigned)
self.expnames = [e.name for e in Experiment.objects.all()]
@@ -341,7 +341,7 @@ def test_mixed_comparisons2(self):
self.assertEqual(test_set, self.expnames[:i])
test_set = [e.name for e in
- Experiment.objects.filter(start__lte=F('assigned')+delay+
+ Experiment.objects.filter(start__lte=F('assigned') + delay +
datetime.timedelta(1))]
self.assertEqual(test_set, self.expnames[:i+1])
17 tests/forms_tests/tests/test_widgets.py
View
@@ -340,7 +340,10 @@ class SomeForm(Form):
</select>""")
# Choices can be nested one level in order to create HTML optgroups:
- w.choices=(('outer1', 'Outer 1'), ('Group "1"', (('inner1', 'Inner 1'), ('inner2', 'Inner 2'))))
+ w.choices = (
+ ('outer1', 'Outer 1'),
+ ('Group "1"', (('inner1', 'Inner 1'), ('inner2', 'Inner 2'))),
+ )
self.assertHTMLEqual(w.render('nestchoice', None), """<select name="nestchoice">
<option value="outer1">Outer 1</option>
<optgroup label="Group &quot;1&quot;">
@@ -706,7 +709,11 @@ class CustomRadioSelect(RadioSelect):
def test_nested_choices(self):
# Choices can be nested for radio buttons:
w = RadioSelect()
- w.choices=(('unknown', 'Unknown'), ('Audio', (('vinyl', 'Vinyl'), ('cd', 'CD'))), ('Video', (('vhs', 'VHS'), ('dvd', 'DVD'))))
+ w.choices = (
+ ('unknown', 'Unknown'),
+ ('Audio', (('vinyl', 'Vinyl'), ('cd', 'CD'))),
+ ('Video', (('vhs', 'VHS'), ('dvd', 'DVD'))),
+ )
self.assertHTMLEqual(w.render('nestchoice', 'dvd', attrs={'id':'media'}), """<ul id="media">
<li><label for="media_0"><input id="media_0" name="nestchoice" type="radio" value="unknown" /> Unknown</label></li>
<li>Audio<ul id="media_1">
@@ -721,7 +728,11 @@ def test_nested_choices(self):
# Choices can be nested for checkboxes:
w = CheckboxSelectMultiple()
- w.choices=(('unknown', 'Unknown'), ('Audio', (('vinyl', 'Vinyl'), ('cd', 'CD'))), ('Video', (('vhs', 'VHS'), ('dvd', 'DVD'))))
+ w.choices = (
+ ('unknown', 'Unknown'),
+ ('Audio', (('vinyl', 'Vinyl'), ('cd', 'CD'))),
+ ('Video', (('vhs', 'VHS'), ('dvd', 'DVD'))),
+ )
self.assertHTMLEqual(w.render('nestchoice', ('vinyl', 'dvd'), attrs={'id':'media'}), """<ul id="media">
<li><label for="media_0"><input id="media_0" name="nestchoice" type="checkbox" value="unknown" /> Unknown</label></li>
<li>Audio<ul id="media_1">
12 tests/i18n/commands/compilation.py
View
@@ -37,8 +37,8 @@ def test_bom_rejection(self):
class PoFileContentsTests(MessageCompilationTests):
# Ticket #11240
- LOCALE='fr'
- MO_FILE='locale/%s/LC_MESSAGES/django.mo' % LOCALE
+ LOCALE = 'fr'
+ MO_FILE = 'locale/%s/LC_MESSAGES/django.mo' % LOCALE
def setUp(self):
super(PoFileContentsTests, self).setUp()
@@ -53,8 +53,8 @@ class PercentRenderingTests(MessageCompilationTests):
# Ticket #11240 -- Testing rendering doesn't belong here but we are trying
# to keep tests for all the stack together
- LOCALE='it'
- MO_FILE='locale/%s/LC_MESSAGES/django.mo' % LOCALE
+ LOCALE = 'it'
+ MO_FILE = 'locale/%s/LC_MESSAGES/django.mo' % LOCALE
def setUp(self):
super(PercentRenderingTests, self).setUp()
@@ -101,8 +101,8 @@ def test_multiple_locales(self):
class CompilationErrorHandling(MessageCompilationTests):
- LOCALE='ja'
- MO_FILE='locale/%s/LC_MESSAGES/django.mo' % LOCALE
+ LOCALE = 'ja'
+ MO_FILE = 'locale/%s/LC_MESSAGES/django.mo' % LOCALE
def setUp(self):
super(CompilationErrorHandling, self).setUp()
8 tests/i18n/commands/extraction.py
View
@@ -17,11 +17,11 @@
from django.utils.translation import TranslatorCommentWarning
-LOCALE='de'
+LOCALE = 'de'
class ExtractorTests(SimpleTestCase):
- PO_FILE='locale/%s/LC_MESSAGES/django.po' % LOCALE
+ PO_FILE = 'locale/%s/LC_MESSAGES/django.po' % LOCALE
def setUp(self):
self._cwd = os.getcwd()
@@ -255,7 +255,7 @@ def test_template_comments(self):
class JavascriptExtractorTests(ExtractorTests):
- PO_FILE='locale/%s/LC_MESSAGES/djangojs.po' % LOCALE
+ PO_FILE = 'locale/%s/LC_MESSAGES/djangojs.po' % LOCALE
def test_javascript_literals(self):
os.chdir(self.test_dir)
@@ -426,7 +426,7 @@ def test_no_location_disabled(self):
class KeepPotFileExtractorTests(ExtractorTests):
- POT_FILE='locale/django.pot'
+ POT_FILE = 'locale/django.pot'
def setUp(self):
super(KeepPotFileExtractorTests, self).setUp()
4 tests/m2m_and_m2o/tests.py
View
@@ -80,8 +80,8 @@ def test_m2m_with_unicode_reference(self):
Regression test for #6045: references to other models can be unicode
strings, providing they are directly convertible to ASCII.
"""
- m1=UnicodeReferenceModel.objects.create()
- m2=UnicodeReferenceModel.objects.create()
+ m1 = UnicodeReferenceModel.objects.create()
+ m2 = UnicodeReferenceModel.objects.create()
m2.others.add(m1) # used to cause an error (see ticket #6045)
m2.save()
list(m2.others.all()) # Force retrieval.
2  tests/m2m_through_regress/tests.py
View
@@ -68,7 +68,7 @@ def test_serialization(self):
p = Person.objects.create(name="Bob")
g = Group.objects.create(name="Roll")
- m =Membership.objects.create(person=p, group=g)
+ m = Membership.objects.create(person=p, group=g)
pks = {"p_pk": p.pk, "g_pk": g.pk, "m_pk": m.pk}
2  tests/model_forms/tests.py
View
@@ -791,7 +791,7 @@ class ModelToDictTests(TestCase):
Tests for forms.models.model_to_dict
"""
def test_model_to_dict_many_to_many(self):
- categories=[
+ categories = [
Category(name='TestName1', slug='TestName1', url='url1'),
Category(name='TestName2', slug='TestName2', url='url2'),
Category(name='TestName3', slug='TestName3', url='url3')
2  tests/model_inheritance_regress/tests.py
View
@@ -82,7 +82,7 @@ def test_model_inheritance(self):
italian_restaurant.serves_gnocchi = False
italian_restaurant.save_base(raw=True)
- place2.name='Derelict lot'
+ place2.name = 'Derelict lot'
place2.save_base(raw=True)
park.capacity = 50
6 tests/multiple_database/tests.py
View
@@ -39,7 +39,7 @@ def test_default_creation(self):
# Create a book on the default database using a save
dive = Book()
- dive.title="Dive into Python"
+ dive.title = "Dive into Python"
dive.published = datetime.date(2009, 5, 4)
dive.save()
@@ -74,7 +74,7 @@ def test_other_creation(self):
# Create a book on the default database using a save
dive = Book()
- dive.title="Dive into Python"
+ dive.title = "Dive into Python"
dive.published = datetime.date(2009, 5, 4)
dive.save(using='other')
@@ -1794,7 +1794,7 @@ def test_attribute_error_read(self):
def test_attribute_error_save(self):
"Check that the AttributeError from AttributeErrorRouter bubbles up"
dive = Book()
- dive.title="Dive into Python"
+ dive.title = "Dive into Python"
dive.published = datetime.date(2009, 5, 4)
self.assertRaises(AttributeError, dive.save)
6 tests/queries/tests.py
View
@@ -579,7 +579,7 @@ def test_tickets_7087_12242(self):
['datetime.datetime(2007, 12, 19, 0, 0)', 'datetime.datetime(2007, 12, 20, 0, 0)']
)
- name="one"
+ name = "one"
self.assertQuerysetEqual(
Item.objects.datetimes('created', 'day').extra(where=['name=%s'], params=[name]),
['datetime.datetime(2007, 12, 19, 0, 0)']
@@ -2670,8 +2670,8 @@ def test_ticket_17886(self):
# b__c__name generates join to c, which the ORM tried to promote but
# failed as that join isn't nullable.
q_obj = (
- Q(d__name='foo')|
- Q(b__name='foo')|
+ Q(d__name='foo') |
+ Q(b__name='foo') |
Q(b__c__name='foo')
)
qset = ModelA.objects.filter(q_obj)
24 tests/select_related_regress/tests.py
View
@@ -23,21 +23,21 @@ def test_regression_7110(self):
and include some unnecessary bonus joins).
"""
- b=Building.objects.create(name='101')
- dev1=Device.objects.create(name="router", building=b)
- dev2=Device.objects.create(name="switch", building=b)
- dev3=Device.objects.create(name="server", building=b)
- port1=Port.objects.create(port_number='4',device=dev1)
- port2=Port.objects.create(port_number='7',device=dev2)
- port3=Port.objects.create(port_number='1',device=dev3)
- c1=Connection.objects.create(start=port1, end=port2)
- c2=Connection.objects.create(start=port2, end=port3)
-
- connections=Connection.objects.filter(start__device__building=b, end__device__building=b).order_by('id')
+ b = Building.objects.create(name='101')
+ dev1 = Device.objects.create(name="router", building=b)
+ dev2 = Device.objects.create(name="switch", building=b)
+ dev3 = Device.objects.create(name="server", building=b)
+ port1 = Port.objects.create(port_number='4',device=dev1)
+ port2 = Port.objects.create(port_number='7',device=dev2)
+ port3 = Port.objects.create(port_number='1',device=dev3)
+ c1 = Connection.objects.create(start=port1, end=port2)
+ c2 = Connection.objects.create(start=port2, end=port3)
+
+ connections = Connection.objects.filter(start__device__building=b, end__device__building=b).order_by('id')
self.assertEqual([(c.id, six.text_type(c.start), six.text_type(c.end)) for c in connections],
[(c1.id, 'router/4', 'switch/7'), (c2.id, 'switch/7', 'server/1')])
- connections=Connection.objects.filter(start__device__building=b, end__device__building=b).select_related().order_by('id')
+ connections = Connection.objects.filter(start__device__building=b, end__device__building=b).select_related().order_by('id')
self.assertEqual([(c.id, six.text_type(c.start), six.text_type(c.end)) for c in connections],
[(c1.id, 'router/4', 'switch/7'), (c2.id, 'switch/7', 'server/1')])
2  tests/validation/tests.py
View
@@ -24,7 +24,7 @@ def test_custom_validate_method(self):
self.assertFailsValidation(mtv.full_clean, [NON_FIELD_ERRORS, 'name'])
def test_wrong_FK_value_raises_error(self):
- mtv=ModelToValidate(number=10, name='Some Name', parent_id=3)
+ mtv = ModelToValidate(number=10, name='Some Name', parent_id=3)
self.assertFailsValidation(mtv.full_clean, ['parent'])
def test_correct_FK_value_validates(self):
Please sign in to comment.
Something went wrong with that request. Please try again.