From 1597503a017a9ced422a81d314cb4097d53c3dfd Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Tue, 22 Oct 2013 09:31:43 -0400 Subject: [PATCH] Fixed E221 pep8 warnings. --- .../contrib/admin/templatetags/admin_list.py | 4 +-- django/contrib/admindocs/views.py | 8 +++++- django/contrib/auth/tests/test_hashers.py | 1 - django/contrib/gis/db/models/query.py | 2 +- django/contrib/gis/geoip/base.py | 8 +++--- django/contrib/gis/geos/libgeos.py | 2 +- django/contrib/gis/geos/mutable_list.py | 26 +++++++++---------- django/contrib/gis/geos/polygon.py | 8 +++--- django/contrib/gis/geos/prototypes/io.py | 8 +++--- django/contrib/gis/maps/google/gmap.py | 4 +-- django/contrib/gis/maps/google/zoom.py | 4 +-- django/contrib/gis/measure.py | 4 +-- django/contrib/gis/tests/geoapp/tests.py | 2 +- django/contrib/gis/tests/layermap/tests.py | 4 +-- django/contrib/gis/tests/utils.py | 4 +-- django/contrib/messages/tests/base.py | 4 +-- django/core/management/templates.py | 2 +- django/template/defaultfilters.py | 4 +-- django/utils/datastructures.py | 22 ++++++++-------- django/utils/synch.py | 12 ++++----- docs/_ext/djangodocs.py | 16 ++++++------ setup.cfg | 2 +- tests/admin_util/tests.py | 5 ++-- tests/i18n/tests.py | 8 +++--- tests/m2m_through_regress/tests.py | 2 +- tests/model_formsets/tests.py | 2 +- tests/multiple_database/tests.py | 2 +- tests/prefetch_related/models.py | 4 +-- tests/queries/tests.py | 8 +++--- tests/validation/models.py | 2 +- 30 files changed, 94 insertions(+), 90 deletions(-) diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index c4b00db8cb..9941ca4c06 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -134,8 +134,8 @@ def result_headers(cl): # build new ordering param o_list_primary = [] # URL for making this field the primary sort - o_list_remove = [] # URL for removing this field from sort - o_list_toggle = [] # URL for toggling order type for this field + o_list_remove = [] # URL for removing this field from sort + o_list_toggle = [] # URL for toggling order type for this field make_qs_param = lambda t, n: ('-' if t == 'desc' else '') + str(n) for j, ot in ordering_field_columns.items(): diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py index 9a3d23a89c..3c888fdb8e 100644 --- a/django/contrib/admindocs/views.py +++ b/django/contrib/admindocs/views.py @@ -204,7 +204,13 @@ def model_detail(request, app_label, model_name): if isinstance(field, models.ForeignKey): data_type = field.rel.to.__name__ app_label = field.rel.to._meta.app_label - verbose = utils.parse_rst((_("the related `%(app_label)s.%(data_type)s` object") % {'app_label': app_label, 'data_type': data_type}), 'model', _('model:') + data_type) + verbose = utils.parse_rst( + (_("the related `%(app_label)s.%(data_type)s` object") % { + 'app_label': app_label, 'data_type': data_type, + }), + 'model', + _('model:') + data_type, + ) else: data_type = get_readable_field_data_type(field) verbose = field.verbose_name diff --git a/django/contrib/auth/tests/test_hashers.py b/django/contrib/auth/tests/test_hashers.py index d0fc9895e9..469c678f21 100644 --- a/django/contrib/auth/tests/test_hashers.py +++ b/django/contrib/auth/tests/test_hashers.py @@ -275,7 +275,6 @@ class TestUtilsHashPass(unittest.TestCase): finally: hasher.iterations = old_iterations - def test_load_library_no_algorithm(self): with self.assertRaises(ValueError) as e: BasePasswordHasher()._load_library() diff --git a/django/contrib/gis/db/models/query.py b/django/contrib/gis/db/models/query.py index aac4e61ec4..149827af5d 100644 --- a/django/contrib/gis/db/models/query.py +++ b/django/contrib/gis/db/models/query.py @@ -678,7 +678,7 @@ class GeoQuerySet(QuerySet): procedure_fmt += ', %s(%%%%s, %s)' % (backend.transform, self.query.transformed_srid) else: # `transform()` was not used on this GeoQuerySet. - procedure_fmt = '%(geo_col)s,%(geom)s' + procedure_fmt = '%(geo_col)s,%(geom)s' if not geography and geodetic: # Spherical distance calculation is needed (because the geographic diff --git a/django/contrib/gis/geoip/base.py b/django/contrib/gis/geoip/base.py index c31cdb47e7..0fb2614b0c 100644 --- a/django/contrib/gis/geoip/base.py +++ b/django/contrib/gis/geoip/base.py @@ -41,11 +41,11 @@ class GeoIP(object): # # GEOIP_MMAP_CACHE - load database into mmap shared memory ( not available # on Windows). - GEOIP_STANDARD = 0 + GEOIP_STANDARD = 0 GEOIP_MEMORY_CACHE = 1 - GEOIP_CHECK_CACHE = 2 - GEOIP_INDEX_CACHE = 4 - GEOIP_MMAP_CACHE = 8 + GEOIP_CHECK_CACHE = 2 + GEOIP_INDEX_CACHE = 4 + GEOIP_MMAP_CACHE = 8 cache_options = dict((opt, None) for opt in (0, 1, 2, 4, 8)) # Paths to the city & country binary databases. diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py index 00880e3f34..d87f55853b 100644 --- a/django/contrib/gis/geos/libgeos.py +++ b/django/contrib/gis/geos/libgeos.py @@ -100,7 +100,7 @@ class GEOSContextHandle_t(Structure): GEOM_PTR = POINTER(GEOSGeom_t) PREPGEOM_PTR = POINTER(GEOSPrepGeom_t) CS_PTR = POINTER(GEOSCoordSeq_t) -CONTEXT_PTR = POINTER(GEOSContextHandle_t) +CONTEXT_PTR = POINTER(GEOSContextHandle_t) # Used specifically by the GEOSGeom_createPolygon and GEOSGeom_createCollection # GEOS routines diff --git a/django/contrib/gis/geos/mutable_list.py b/django/contrib/gis/geos/mutable_list.py index 592d1e6242..917b0151a5 100644 --- a/django/contrib/gis/geos/mutable_list.py +++ b/django/contrib/gis/geos/mutable_list.py @@ -88,17 +88,17 @@ class ListMixin(object): raise TypeError("%s is not a legal index" % index) # calculate new length and dimensions - origLen = len(self) + origLen = len(self) if isinstance(index, six.integer_types): index = self._checkindex(index) - indexRange = [index] + indexRange = [index] else: - indexRange = range(*index.indices(origLen)) + indexRange = range(*index.indices(origLen)) - newLen = origLen - len(indexRange) - newItems = (self._get_single_internal(i) - for i in xrange(origLen) - if i not in indexRange) + newLen = origLen - len(indexRange) + newItems = (self._get_single_internal(i) + for i in xrange(origLen) + if i not in indexRange) self._rebuild(newLen, newItems) @@ -268,8 +268,8 @@ class ListMixin(object): self._check_allowed(values) - origLen = len(self) - valueList = list(values) + origLen = len(self) + valueList = list(values) start, stop, step = index.indices(origLen) # CAREFUL: index.step and step are not the same! @@ -281,7 +281,7 @@ class ListMixin(object): def _assign_extended_slice_rebuild(self, start, stop, step, valueList): 'Assign an extended slice by rebuilding entire list' - indexList = range(start, stop, step) + indexList = range(start, stop, step) # extended slice, only allow assigning slice of same size if len(valueList) != len(indexList): raise ValueError('attempt to assign sequence of size %d ' @@ -289,7 +289,7 @@ class ListMixin(object): % (len(valueList), len(indexList))) # we're not changing the length of the sequence - newLen = len(self) + newLen = len(self) newVals = dict(zip(indexList, valueList)) def newItems(): for i in xrange(newLen): @@ -302,7 +302,7 @@ class ListMixin(object): def _assign_extended_slice(self, start, stop, step, valueList): 'Assign an extended slice by re-assigning individual items' - indexList = range(start, stop, step) + indexList = range(start, stop, step) # extended slice, only allow assigning slice of same size if len(valueList) != len(indexList): raise ValueError('attempt to assign sequence of size %d ' @@ -316,7 +316,7 @@ class ListMixin(object): 'Assign a simple slice; Can assign slice of any length' origLen = len(self) stop = max(start, stop) - newLen = origLen - stop + start + len(valueList) + newLen = origLen - stop + start + len(valueList) def newItems(): for i in xrange(origLen + 1): if i == start: diff --git a/django/contrib/gis/geos/polygon.py b/django/contrib/gis/geos/polygon.py index 8e38f7b167..0da90e3a19 100644 --- a/django/contrib/gis/geos/polygon.py +++ b/django/contrib/gis/geos/polygon.py @@ -37,11 +37,11 @@ class Polygon(GEOSGeometry): # If initialized as Polygon(shell, (LinearRing, LinearRing)) [for backward-compatibility] if n_holes == 1 and isinstance(init_holes[0], (tuple, list)): if len(init_holes[0]) == 0: - init_holes = () - n_holes = 0 + init_holes = () + n_holes = 0 elif isinstance(init_holes[0][0], LinearRing): - init_holes = init_holes[0] - n_holes = len(init_holes) + init_holes = init_holes[0] + n_holes = len(init_holes) polygon = self._create_polygon(n_holes + 1, (ext_ring,) + init_holes) super(Polygon, self).__init__(polygon, **kwargs) diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py index c7233f79fc..acbd3ebc59 100644 --- a/django/contrib/gis/geos/prototypes/io.py +++ b/django/contrib/gis/geos/prototypes/io.py @@ -23,9 +23,9 @@ class WKBReader_st(Structure): class WKBWriter_st(Structure): pass -WKT_READ_PTR = POINTER(WKTReader_st) +WKT_READ_PTR = POINTER(WKTReader_st) WKT_WRITE_PTR = POINTER(WKTWriter_st) -WKB_READ_PTR = POINTER(WKBReader_st) +WKB_READ_PTR = POINTER(WKBReader_st) WKB_WRITE_PTR = POINTER(WKBReader_st) ### WKTReader routines ### @@ -114,8 +114,8 @@ def wkb_writer_set(func, argtype=c_int): wkb_writer_get_byteorder = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getByteOrder')) wkb_writer_set_byteorder = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setByteOrder')) -wkb_writer_get_outdim = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getOutputDimension')) -wkb_writer_set_outdim = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setOutputDimension')) +wkb_writer_get_outdim = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getOutputDimension')) +wkb_writer_set_outdim = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setOutputDimension')) wkb_writer_get_include_srid = wkb_writer_get(GEOSFunc('GEOSWKBWriter_getIncludeSRID'), restype=c_char) wkb_writer_set_include_srid = wkb_writer_set(GEOSFunc('GEOSWKBWriter_setIncludeSRID'), argtype=c_char) diff --git a/django/contrib/gis/maps/google/gmap.py b/django/contrib/gis/maps/google/gmap.py index 0128581da4..4fe9b1198a 100644 --- a/django/contrib/gis/maps/google/gmap.py +++ b/django/contrib/gis/maps/google/gmap.py @@ -20,8 +20,8 @@ class GoogleMap(object): # String constants onunload = mark_safe('onunload="GUnload()"') # Cleans up after Google Maps - vml_css = mark_safe('v\:* {behavior:url(#default#VML);}') # CSS for IE VML - xmlns = mark_safe('xmlns:v="urn:schemas-microsoft-com:vml"') # XML Namespace (for IE VML). + vml_css = mark_safe('v\:* {behavior:url(#default#VML);}') # CSS for IE VML + xmlns = mark_safe('xmlns:v="urn:schemas-microsoft-com:vml"') # XML Namespace (for IE VML). def __init__(self, key=None, api_url=None, version=None, center=None, zoom=None, dom_id='map', diff --git a/django/contrib/gis/maps/google/zoom.py b/django/contrib/gis/maps/google/zoom.py index af1dee14e6..0e702c9905 100644 --- a/django/contrib/gis/maps/google/zoom.py +++ b/django/contrib/gis/maps/google/zoom.py @@ -34,7 +34,7 @@ class GoogleZoom(object): # zoom levels. self._degpp = [] # Degrees per pixel self._radpp = [] # Radians per pixel - self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level + self._npix = [] # 1/2 the number of pixels for a tile at the given zoom level # Incrementing through the zoom levels and populating the parameter arrays. z = tilesize # The number of pixels per zoom level. @@ -158,5 +158,5 @@ class GoogleZoom(object): ur = Point(extent[2:]) # Calculating the width and height. height = ll.distance(ul) - width = ul.distance(ur) + width = ul.distance(ur) return width, height diff --git a/django/contrib/gis/measure.py b/django/contrib/gis/measure.py index 3335f8f935..7b4afef16f 100644 --- a/django/contrib/gis/measure.py +++ b/django/contrib/gis/measure.py @@ -51,8 +51,8 @@ def pretty_name(obj): @total_ordering class MeasureBase(object): STANDARD_UNIT = None - ALIAS = {} - UNITS = {} + ALIAS = {} + UNITS = {} LALIAS = {} def __init__(self, default_unit=None, **kwargs): diff --git a/django/contrib/gis/tests/geoapp/tests.py b/django/contrib/gis/tests/geoapp/tests.py index 15f5936dd6..5dd56b45a9 100644 --- a/django/contrib/gis/tests/geoapp/tests.py +++ b/django/contrib/gis/tests/geoapp/tests.py @@ -118,7 +118,7 @@ class GeoModelTest(TestCase): # San Antonio in 'Texas 4205, Southern Zone (1983, meters)' (SRID 41157) # Used the following Oracle SQL to get this value: # SELECT SDO_UTIL.TO_WKTGEOMETRY(SDO_CS.TRANSFORM(SDO_GEOMETRY('POINT (-98.493183 29.424170)', 4326), 41157)) FROM DUAL; - nad_wkt = 'POINT (300662.034646583 5416427.45974934)' + nad_wkt = 'POINT (300662.034646583 5416427.45974934)' nad_srid = 41157 else: # San Antonio in 'NAD83(HARN) / Texas Centric Lambert Conformal' (SRID 3084) diff --git a/django/contrib/gis/tests/layermap/tests.py b/django/contrib/gis/tests/layermap/tests.py index a77a3841fc..ded73fc174 100644 --- a/django/contrib/gis/tests/layermap/tests.py +++ b/django/contrib/gis/tests/layermap/tests.py @@ -31,8 +31,8 @@ inter_shp = os.path.join(shp_path, 'interstates', 'interstates.shp') invalid_shp = os.path.join(shp_path, 'invalid', 'emptypoints.shp') # Dictionaries to hold what's expected in the county shapefile. -NAMES = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo'] -NUMS = [1, 2, 1, 19, 1] # Number of polygons for each. +NAMES = ['Bexar', 'Galveston', 'Harris', 'Honolulu', 'Pueblo'] +NUMS = [1, 2, 1, 19, 1] # Number of polygons for each. STATES = ['Texas', 'Texas', 'Texas', 'Hawaii', 'Colorado'] diff --git a/django/contrib/gis/tests/utils.py b/django/contrib/gis/tests/utils.py index 1868b30b68..e6433e6489 100644 --- a/django/contrib/gis/tests/utils.py +++ b/django/contrib/gis/tests/utils.py @@ -30,9 +30,9 @@ def no_spatialite(func): # Shortcut booleans to omit only portions of tests. _default_db = settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] -oracle = _default_db == 'oracle' +oracle = _default_db == 'oracle' postgis = _default_db == 'postgis' -mysql = _default_db == 'mysql' +mysql = _default_db == 'mysql' spatialite = _default_db == 'spatialite' HAS_SPATIALREFSYS = True diff --git a/django/contrib/messages/tests/base.py b/django/contrib/messages/tests/base.py index 7f378ba7bd..5e3fba2553 100644 --- a/django/contrib/messages/tests/base.py +++ b/django/contrib/messages/tests/base.py @@ -57,9 +57,9 @@ class BaseTests(object): def setUp(self): self.settings_override = override_settings_tags( - TEMPLATE_DIRS = (), + TEMPLATE_DIRS = (), TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS, - MESSAGE_TAGS = '', + MESSAGE_TAGS = '', MESSAGE_STORAGE = '%s.%s' % (self.storage_class.__module__, self.storage_class.__name__), SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer', diff --git a/django/core/management/templates.py b/django/core/management/templates.py index ea4bd1164b..728b1af34c 100644 --- a/django/core/management/templates.py +++ b/django/core/management/templates.py @@ -229,7 +229,7 @@ class TemplateCommand(BaseCommand): tmp = url.rstrip('/') filename = tmp.split('/')[-1] if url.endswith('/'): - display_url = tmp + '/' + display_url = tmp + '/' else: display_url = url return filename, display_url diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index a110ad5bb9..b45321e445 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -194,10 +194,10 @@ def linenumbers(value, autoescape=None): width = six.text_type(len(six.text_type(len(lines)))) if not autoescape or isinstance(value, SafeData): for i, line in enumerate(lines): - lines[i] = ("%0" + width + "d. %s") % (i + 1, line) + lines[i] = ("%0" + width + "d. %s") % (i + 1, line) else: for i, line in enumerate(lines): - lines[i] = ("%0" + width + "d. %s") % (i + 1, escape(line)) + lines[i] = ("%0" + width + "d. %s") % (i + 1, escape(line)) return mark_safe('\n'.join(lines)) @register.filter(is_safe=True) diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index fe0fc164e9..d73f4aa546 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -490,19 +490,19 @@ class ImmutableList(tuple): raise AttributeError(self.warning) # All list mutation functions complain. - __delitem__ = complain + __delitem__ = complain __delslice__ = complain - __iadd__ = complain - __imul__ = complain - __setitem__ = complain + __iadd__ = complain + __imul__ = complain + __setitem__ = complain __setslice__ = complain - append = complain - extend = complain - insert = complain - pop = complain - remove = complain - sort = complain - reverse = complain + append = complain + extend = complain + insert = complain + pop = complain + remove= complain + sort = complain + reverse = complain class DictWrapper(dict): """ diff --git a/django/utils/synch.py b/django/utils/synch.py index 4859907ae2..8bb7293fd4 100644 --- a/django/utils/synch.py +++ b/django/utils/synch.py @@ -27,11 +27,11 @@ class RWLock(object): writer_leaves() """ def __init__(self): - self.mutex = threading.RLock() - self.can_read = threading.Semaphore(0) + self.mutex = threading.RLock() + self.can_read = threading.Semaphore(0) self.can_write = threading.Semaphore(0) - self.active_readers = 0 - self.active_writers = 0 + self.active_readers = 0 + self.active_writers = 0 self.waiting_readers = 0 self.waiting_writers = 0 @@ -48,7 +48,7 @@ class RWLock(object): with self.mutex: self.active_readers -= 1 if self.active_readers == 0 and self.waiting_writers != 0: - self.active_writers += 1 + self.active_writers += 1 self.waiting_writers -= 1 self.can_write.release() @@ -73,7 +73,7 @@ class RWLock(object): with self.mutex: self.active_writers -= 1 if self.waiting_writers != 0: - self.active_writers += 1 + self.active_writers += 1 self.waiting_writers -= 1 self.can_write.release() elif self.waiting_readers != 0: diff --git a/docs/_ext/djangodocs.py b/docs/_ext/djangodocs.py index 1c1ed53672..e951841884 100644 --- a/docs/_ext/djangodocs.py +++ b/docs/_ext/djangodocs.py @@ -22,35 +22,35 @@ simple_option_desc_re = re.compile( def setup(app): app.add_crossref_type( directivename = "setting", - rolename = "setting", + rolename = "setting", indextemplate = "pair: %s; setting", ) app.add_crossref_type( directivename = "templatetag", - rolename = "ttag", + rolename = "ttag", indextemplate = "pair: %s; template tag" ) app.add_crossref_type( directivename = "templatefilter", - rolename = "tfilter", + rolename = "tfilter", indextemplate = "pair: %s; template filter" ) app.add_crossref_type( directivename = "fieldlookup", - rolename = "lookup", + rolename = "lookup", indextemplate = "pair: %s; field lookup type", ) app.add_description_unit( directivename = "django-admin", - rolename = "djadmin", + rolename = "djadmin", indextemplate = "pair: %s; django-admin command", - parse_node = parse_django_admin_node, + parse_node = parse_django_admin_node, ) app.add_description_unit( directivename = "django-admin-option", - rolename = "djadminopt", + rolename = "djadminopt", indextemplate = "pair: %s; django-admin command-line option", - parse_node = parse_django_adminopt_node, + parse_node = parse_django_adminopt_node, ) app.add_config_value('django_next_version', '0.0', True) app.add_directive('versionadded', VersionDirective) diff --git a/setup.cfg b/setup.cfg index 50d79b5a2d..453d7aa4a8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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,E221,E231,E261,E301,F401,F403,W601 +ignore=E124,E125,E127,E128,E225,E226,E241,E251,E302,E501,E203,E231,E261,E301,F401,F403,W601 [metadata] license-file = LICENSE diff --git a/tests/admin_util/tests.py b/tests/admin_util/tests.py index 31bb412af4..915dfced08 100644 --- a/tests/admin_util/tests.py +++ b/tests/admin_util/tests.py @@ -22,7 +22,6 @@ from .models import Article, Count, Event, Location, EventGuide class NestedObjectsTests(TestCase): """ Tests for ``NestedObject`` utility collection. - """ def setUp(self): self.n = NestedObjects(using=DEFAULT_DB_ALIAS) @@ -295,7 +294,7 @@ class UtilTests(SimpleTestCase): # safestring should not be escaped class MyForm(forms.Form): text = forms.CharField(label=mark_safe('text')) - cb = forms.BooleanField(label=mark_safe('cb')) + cb = forms.BooleanField(label=mark_safe('cb')) form = MyForm() self.assertHTMLEqual(helpers.AdminField(form, 'text', is_first=False).label_tag(), @@ -306,7 +305,7 @@ class UtilTests(SimpleTestCase): # normal strings needs to be escaped class MyForm(forms.Form): text = forms.CharField(label='&text') - cb = forms.BooleanField(label='&cb') + cb = forms.BooleanField(label='&cb') form = MyForm() self.assertHTMLEqual(helpers.AdminField(form, 'text', is_first=False).label_tag(), diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index fbb3476f91..1e16caeaad 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -1190,16 +1190,16 @@ class LocaleMiddlewareTests(TransRealMixin, TestCase): # Clear the session data before request session.save() - response = self.client.get('/en/simple/') + self.client.get('/en/simple/') self.assertEqual(self.client.session['_language'], 'en') # Clear the session data before request session.save() - response = self.client.get('/fr/simple/') + self.client.get('/fr/simple/') self.assertEqual(self.client.session['_language'], 'fr') # Check that language is not changed in session - response = self.client.get('/en/simple/') + self.client.get('/en/simple/') self.assertEqual(self.client.session['_language'], 'fr') @override_settings( @@ -1221,7 +1221,7 @@ class LocaleMiddlewareTests(TransRealMixin, TestCase): self.client.cookies[settings.SESSION_COOKIE_NAME] = session.session_key # request other language; should default to old language key value - response = self.client.get('/fr/simple/') + self.client.get('/fr/simple/') self.assertEqual(self.client.session['_language'], 'en') diff --git a/tests/m2m_through_regress/tests.py b/tests/m2m_through_regress/tests.py index c1b229b30b..3f5702efa8 100644 --- a/tests/m2m_through_regress/tests.py +++ b/tests/m2m_through_regress/tests.py @@ -98,7 +98,7 @@ class M2MThroughTestCase(TestCase): def test_join_trimming(self): "Check that we don't involve too many copies of the intermediate table when doing a join. Refs #8046, #8254" - bob = Person.objects.create(name="Bob") + bob = Person.objects.create(name="Bob") jim = Person.objects.create(name="Jim") rock = Group.objects.create(name="Rock") diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py index b73e2afe5c..061d8c53e1 100644 --- a/tests/model_formsets/tests.py +++ b/tests/model_formsets/tests.py @@ -466,7 +466,7 @@ class ModelFormsetTest(TestCase): formset = AuthorBooksFormSet(instance=author) self.assertEqual(len(formset.forms), 3) self.assertHTMLEqual(formset.forms[0].as_p(), - '

' % author.id) + '

' % author.id) self.assertHTMLEqual(formset.forms[1].as_p(), '

' % author.id) self.assertHTMLEqual(formset.forms[2].as_p(), diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py index 09c43414a5..431d62e112 100644 --- a/tests/multiple_database/tests.py +++ b/tests/multiple_database/tests.py @@ -1864,7 +1864,7 @@ class SyncOnlyDefaultDatabaseRouter(object): class MigrateTestCase(TestCase): - available_apps = [ + available_apps = [ 'multiple_database', 'django.contrib.auth', 'django.contrib.contenttypes' diff --git a/tests/prefetch_related/models.py b/tests/prefetch_related/models.py index bd3df00c6f..307cee1900 100644 --- a/tests/prefetch_related/models.py +++ b/tests/prefetch_related/models.py @@ -147,8 +147,8 @@ class Comment(models.Model): comment = models.TextField() # Content-object field - content_type = models.ForeignKey(ContentType) - object_pk = models.TextField() + content_type = models.ForeignKey(ContentType) + object_pk = models.TextField() content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk") diff --git a/tests/queries/tests.py b/tests/queries/tests.py index abc3c76c8f..b1c6336088 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -1437,7 +1437,7 @@ class Queries4Tests(BaseQuerysetTest): self.assertQuerysetEqual(qs, [ci2.pk, ci3.pk], lambda x: x.pk, False) def test_ticket15316_one2one_filter_false(self): - c = SimpleCategory.objects.create(name="cat") + c = SimpleCategory.objects.create(name="cat") c0 = SimpleCategory.objects.create(name="cat0") c1 = SimpleCategory.objects.create(name="category1") @@ -1453,7 +1453,7 @@ class Queries4Tests(BaseQuerysetTest): self.assertQuerysetEqual(qs, [ci2.pk, ci3.pk], lambda x: x.pk, False) def test_ticket15316_one2one_exclude_false(self): - c = SimpleCategory.objects.create(name="cat") + c = SimpleCategory.objects.create(name="cat") c0 = SimpleCategory.objects.create(name="cat0") c1 = SimpleCategory.objects.create(name="category1") @@ -1469,7 +1469,7 @@ class Queries4Tests(BaseQuerysetTest): self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk) def test_ticket15316_one2one_filter_true(self): - c = SimpleCategory.objects.create(name="cat") + c = SimpleCategory.objects.create(name="cat") c0 = SimpleCategory.objects.create(name="cat0") c1 = SimpleCategory.objects.create(name="category1") @@ -1485,7 +1485,7 @@ class Queries4Tests(BaseQuerysetTest): self.assertQuerysetEqual(qs, [ci1.pk], lambda x: x.pk) def test_ticket15316_one2one_exclude_true(self): - c = SimpleCategory.objects.create(name="cat") + c = SimpleCategory.objects.create(name="cat") c0 = SimpleCategory.objects.create(name="cat0") c1 = SimpleCategory.objects.create(name="category1") diff --git a/tests/validation/models.py b/tests/validation/models.py index 958740dd2d..ee5bcfc9aa 100644 --- a/tests/validation/models.py +++ b/tests/validation/models.py @@ -50,7 +50,7 @@ class UniqueForDateModel(models.Model): name = models.CharField(max_length=100) class CustomMessagesModel(models.Model): - other = models.IntegerField(blank=True, null=True) + other = models.IntegerField(blank=True, null=True) number = models.IntegerField(db_column='number_val', error_messages={'null': 'NULL', 'not42': 'AAARGH', 'not_equal': '%s != me'}, validators=[validate_answer_to_universe]