Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21298 -- Fixed E301 pep8 warnings

  • Loading branch information...
commit c3aa2948c6c14862407501290571f858ccf45b07 1 parent 317040a
@alasdairnicol alasdairnicol authored
Showing with 180 additions and 2 deletions.
  1. +4 −0 django/contrib/auth/tests/test_hashers.py
  2. +1 −0  django/contrib/auth/tests/test_tokens.py
  3. +2 −0  django/contrib/formtools/tests/wizard/wizardtests/tests.py
  4. +1 −0  django/contrib/gis/admin/widgets.py
  5. +1 −0  django/contrib/gis/db/backends/oracle/models.py
  6. +3 −0  django/contrib/gis/db/backends/postgis/operations.py
  7. +1 −0  django/contrib/gis/db/backends/spatialite/operations.py
  8. +1 −0  django/contrib/gis/db/models/sql/conversion.py
  9. +1 −0  django/contrib/gis/forms/widgets.py
  10. +1 −0  django/contrib/gis/gdal/prototypes/generation.py
  11. +2 −0  django/contrib/gis/geos/mutable_list.py
  12. +1 −0  django/contrib/gis/geos/tests/test_geos.py
  13. +9 −0 django/contrib/gis/geos/tests/test_mutable_list.py
  14. +1 −0  django/contrib/gis/tests/inspectapp/tests.py
  15. +1 −0  django/contrib/gis/tests/test_geoforms.py
  16. +1 −0  django/contrib/messages/storage/cookie.py
  17. +1 −0  django/contrib/sitemaps/tests/test_http.py
  18. +1 −0  django/core/files/move.py
  19. +1 −0  django/db/migrations/graph.py
  20. +1 −0  django/db/migrations/recorder.py
  21. +1 −0  django/forms/formsets.py
  22. +2 −0  django/forms/models.py
  23. +1 −0  django/forms/widgets.py
  24. +2 −0  django/template/defaultfilters.py
  25. +2 −0  django/test/utils.py
  26. +2 −0  django/utils/decorators.py
  27. +3 −0  django/utils/feedgenerator.py
  28. +5 −0 django/utils/html.py
  29. +6 −0 django/utils/six.py
  30. +1 −0  django/utils/text.py
  31. +2 −2 setup.cfg
  32. +1 −0  tests/admin_scripts/complex_app/models/bar.py
  33. +1 −0  tests/admin_scripts/complex_app/models/foo.py
  34. +1 −0  tests/admin_scripts/tests.py
  35. +3 −0  tests/admin_validation/tests.py
  36. +5 −0 tests/admin_views/models.py
  37. +2 −0  tests/basic/tests.py
  38. +1 −0  tests/cache/tests.py
  39. +2 −0  tests/custom_pk/models.py
  40. +1 −0  tests/decorators/tests.py
  41. +2 −0  tests/defaultfilters/tests.py
  42. +4 −0 tests/delete/tests.py
  43. +1 −0  tests/delete_regress/tests.py
  44. +11 −0 tests/deprecation/tests.py
  45. +1 −0  tests/expressions/tests.py
  46. +4 −0 tests/file_storage/tests.py
  47. +1 −0  tests/fixtures/models.py
  48. +2 −0  tests/forms_tests/tests/test_extra.py
  49. +1 −0  tests/forms_tests/tests/test_fields.py
  50. +2 −0  tests/forms_tests/tests/test_forms.py
  51. +2 −0  tests/forms_tests/tests/test_media.py
  52. +4 −0 tests/forms_tests/tests/test_widgets.py
  53. +1 −0  tests/generic_relations_regress/tests.py
  54. +1 −0  tests/generic_views/views.py
  55. +1 −0  tests/inspectdb/tests.py
  56. +3 −0  tests/lookup/models.py
  57. +2 −0  tests/middleware/tests.py
  58. +1 −0  tests/migrations/test_operations.py
  59. +2 −0  tests/migrations/test_state.py
  60. +1 −0  tests/model_forms/models.py
  61. +3 −0  tests/model_forms/tests.py
  62. +1 −0  tests/model_forms_regress/tests.py
  63. +2 −0  tests/model_formsets/tests.py
  64. +1 −0  tests/model_inheritance_regress/models.py
  65. +2 −0  tests/modeladmin/tests.py
  66. +1 −0  tests/one_to_one/tests.py
  67. +2 −0  tests/ordering/models.py
  68. +3 −0  tests/queries/tests.py
  69. +1 −0  tests/requests/tests.py
  70. +1 −0  tests/select_for_update/tests.py
  71. +9 −0 tests/select_related/models.py
  72. +1 −0  tests/serializers_regress/models.py
  73. +2 −0  tests/tablespaces/models.py
  74. +7 −0 tests/template_tests/test_callables.py
  75. +5 −0 tests/template_tests/test_parser.py
  76. +1 −0  tests/template_tests/test_response.py
  77. +1 −0  tests/template_tests/tests.py
  78. +2 −0  tests/test_client_regress/tests.py
  79. +1 −0  tests/transactions_regress/tests.py
  80. +4 −0 tests/update_only_fields/tests.py
  81. +1 −0  tests/utils_tests/test_functional.py
  82. +2 −0  tests/validators/tests.py
  83. +1 −0  tests/wsgi/tests.py
View
4 django/contrib/auth/tests/test_hashers.py
@@ -222,6 +222,7 @@ def test_upgrade(self):
for algo in ('sha1', 'md5'):
encoded = make_password('lètmein', hasher=algo)
state = {'upgraded': False}
+
def setter(password):
state['upgraded'] = True
self.assertTrue(check_password('lètmein', encoded, setter))
@@ -230,6 +231,7 @@ def setter(password):
def test_no_upgrade(self):
encoded = make_password('lètmein')
state = {'upgraded': False}
+
def setter():
state['upgraded'] = True
self.assertFalse(check_password('WRONG', encoded, setter))
@@ -240,6 +242,7 @@ def test_no_upgrade_on_incorrect_pass(self):
for algo in ('sha1', 'md5'):
encoded = make_password('lètmein', hasher=algo)
state = {'upgraded': False}
+
def setter():
state['upgraded'] = True
self.assertFalse(check_password('WRONG', encoded, setter))
@@ -259,6 +262,7 @@ def test_pbkdf2_upgrade(self):
self.assertEqual(iterations, '1')
state = {'upgraded': False}
+
def setter(password):
state['upgraded'] = True
View
1  django/contrib/auth/tests/test_tokens.py
@@ -43,6 +43,7 @@ def test_timeout(self):
class Mocked(PasswordResetTokenGenerator):
def __init__(self, today):
self._today_val = today
+
def _today(self):
return self._today_val
View
2  django/contrib/formtools/tests/wizard/wizardtests/tests.py
@@ -418,8 +418,10 @@ def setUp(self):
def test_set_instance(self):
# Regression test for #21259
poet = self.poet
+
class InlineFormSetWizard(CookieWizardView):
instance = None
+
def get_form_instance(self, step):
if self.instance is None:
self.instance = poet
View
1  django/contrib/gis/admin/widgets.py
@@ -87,6 +87,7 @@ def map_options(self):
# JavaScript construction utilities for the Bounds and Projection.
def ol_bounds(extent):
return 'new OpenLayers.Bounds(%s)' % str(extent)
+
def ol_projection(srid):
return 'new OpenLayers.Projection("EPSG:%s")' % srid
View
1  django/contrib/gis/db/backends/oracle/models.py
@@ -18,6 +18,7 @@ class GeometryColumns(models.Model):
column_name = models.CharField(max_length=1024)
srid = models.IntegerField(primary_key=True)
# TODO: Add support for `diminfo` column (type MDSYS.SDO_DIM_ARRAY).
+
class Meta:
db_table = 'USER_SDO_GEOM_METADATA'
managed = False
View
3  django/contrib/gis/db/backends/postgis/operations.py
@@ -44,6 +44,7 @@ class PostGISSpheroidDistance(PostGISFunction):
"For PostGIS spherical distance operations (using the spheroid)."
dist_func = 'distance_spheroid'
sql_template = '%(function)s(%(geo_col)s, %(geometry)s, %%s) %(operator)s %%s'
+
def __init__(self, prefix, operator):
# An extra parameter in `end_subst` is needed for the spheroid string.
super(PostGISSpheroidDistance, self).__init__(prefix, self.dist_func,
@@ -137,6 +138,7 @@ def __init__(self, connection):
# Valid distance types and substitutions
dtypes = (Decimal, Distance, float) + six.integer_types
+
def get_dist_ops(operator):
"Returns operations for both regular and spherical distances."
return {'cartesian' : PostGISDistance(prefix, operator),
@@ -455,6 +457,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
if (lookup_type in self.distance_functions and
View
1  django/contrib/gis/db/backends/spatialite/operations.py
@@ -40,6 +40,7 @@ def __init__(self, operator):
class SpatiaLiteRelate(SpatiaLiteFunctionParam):
"For SpatiaLite Relate(<geom>, <pattern>) calls."
pattern_regex = re.compile(r'^[012TF\*]{9}$')
+
def __init__(self, pattern):
if not self.pattern_regex.match(pattern):
raise ValueError('Invalid intersection matrix pattern "%s".' % pattern)
View
1  django/contrib/gis/db/models/sql/conversion.py
@@ -5,6 +5,7 @@
class BaseField(object):
empty_strings_allowed = True
+
def get_internal_type(self):
"Overloaded method so OracleQuery.convert_values doesn't balk."
return None
View
1  django/contrib/gis/forms/widgets.py
@@ -79,6 +79,7 @@ def render(self, name, value, attrs=None):
class OpenLayersWidget(BaseGeometryWidget):
template_name = 'gis/openlayers.html'
+
class Media:
js = (
'http://openlayers.org/api/2.13/OpenLayers.js',
View
1  django/contrib/gis/gdal/prototypes/generation.py
@@ -36,6 +36,7 @@ def geom_output(func, argtypes, offset=None):
else:
# Error code returned, geometry is returned by-reference.
func.restype = c_int
+
def geomerrcheck(result, func, cargs):
return check_geom_offset(result, func, cargs, offset)
func.errcheck = geomerrcheck
View
2  django/contrib/gis/geos/mutable_list.py
@@ -291,6 +291,7 @@ def _assign_extended_slice_rebuild(self, start, stop, step, valueList):
# we're not changing the length of the sequence
newLen = len(self)
newVals = dict(zip(indexList, valueList))
+
def newItems():
for i in xrange(newLen):
if i in newVals:
@@ -317,6 +318,7 @@ def _assign_simple_slice(self, start, stop, valueList):
origLen = len(self)
stop = max(start, stop)
newLen = origLen - stop + start + len(valueList)
+
def newItems():
for i in xrange(origLen + 1):
if i == start:
View
1  django/contrib/gis/geos/tests/test_geos.py
@@ -51,6 +51,7 @@ class FakeGeom1(GEOSBase):
# This one only accepts pointers to floats
c_float_p = ctypes.POINTER(ctypes.c_float)
+
class FakeGeom2(GEOSBase):
ptr_type = c_float_p
View
9 django/contrib/gis/geos/tests/test_mutable_list.py
@@ -12,6 +12,7 @@
class UserListA(ListMixin):
_mytype = tuple
+
def __init__(self, i_list, *args, **kwargs):
self._list = self._mytype(i_list)
super(UserListA, self).__init__(*args, **kwargs)
@@ -211,8 +212,10 @@ def test05_out_of_range_exceptions(self):
'Out of range exceptions'
def setfcn(x, i):
x[i] = 20
+
def getfcn(x, i):
return x[i]
+
def delfcn(x, i):
del x[i]
pl, ul = self.lists_of_len()
@@ -252,6 +255,7 @@ def test06_list_methods(self):
self.assertEqual(pl[:], ul[:], 'after pop')
pl, ul = self.lists_of_len()
+
def popfcn(x, i):
x.pop(i)
self.assertRaises(IndexError, popfcn, ul, self.limit)
@@ -272,6 +276,7 @@ def popfcn(x, i):
def indexfcn(x, v):
return x.index(v)
+
def removefcn(x, v):
return x.remove(v)
self.assertRaises(ValueError, indexfcn, ul, 40)
@@ -283,6 +288,7 @@ def test07_allowed_types(self):
ul._allowed = six.integer_types
ul[1] = 50
ul[:2] = [60, 70, 80]
+
def setfcn(x, i, v):
x[i] = v
self.assertRaises(TypeError, setfcn, ul, 2, 'hello')
@@ -292,8 +298,10 @@ def test08_min_length(self):
'Length limits'
pl, ul = self.lists_of_len()
ul._minlength = 1
+
def delfcn(x,i):
del x[:i]
+
def setfcn(x,i):
x[:i] = []
for i in range(self.limit - ul._minlength + 1, self.limit + 1):
@@ -309,6 +317,7 @@ def setfcn(x,i):
def test09_iterable_check(self):
'Error on assigning non-iterable to slice'
pl, ul = self.lists_of_len(self.limit + 1)
+
def setfcn(x, i, v):
x[i] = v
self.assertRaises(TypeError, setfcn, ul, slice(0,3,2), 2)
View
1  django/contrib/gis/tests/inspectapp/tests.py
@@ -148,6 +148,7 @@ def get_ogr_db_string():
# Build the params of the OGR database connection string
params = [db_str % {'db_name': db['NAME']}]
+
def add(key, template):
value = db.get(key, None)
# Don't add the parameter if it is not in django's settings
View
1  django/contrib/gis/tests/test_geoforms.py
@@ -263,6 +263,7 @@ def test_custom_serialization_widget(self):
class CustomGeometryWidget(forms.BaseGeometryWidget):
template_name = 'gis/openlayers.html'
deserialize_called = 0
+
def serialize(self, value):
return value.json if value else ''
View
1  django/contrib/messages/storage/cookie.py
@@ -101,6 +101,7 @@ def _store(self, messages, response, remove_oldest=True, *args, **kwargs):
# data is going to be stored eventually by SimpleCookie, which
# adds it's own overhead, which we must account for.
cookie = SimpleCookie() # create outside the loop
+
def stored_length(val):
return len(cookie.value_encode(val)[1])
View
1  django/contrib/sitemaps/tests/test_http.py
@@ -142,6 +142,7 @@ def test_sitemap_item(self):
Sitemap.get_url() url result.
"""
test_sitemap = GenericSitemap({'queryset': TestModel.objects.all()})
+
def is_testmodel(url):
return isinstance(url['item'], TestModel)
item_in_url_info = all(map(is_testmodel, test_sitemap.get_urls()))
View
1  django/core/files/move.py
@@ -12,6 +12,7 @@
from shutil import copystat
except ImportError:
import stat
+
def copystat(src, dst):
"""Copy all stat info (mode bits, atime and mtime) from src to dst"""
st = os.stat(src)
View
1  django/db/migrations/graph.py
@@ -93,6 +93,7 @@ def dfs(self, start, get_children):
Dynamic programming based depth first search, for finding dependencies.
"""
cache = {}
+
def _dfs(start, get_children, path):
# If we already computed this, use that (dynamic programming)
if (start, get_children) in cache:
View
1  django/db/migrations/recorder.py
@@ -20,6 +20,7 @@ class Migration(models.Model):
app = models.CharField(max_length=255)
name = models.CharField(max_length=255)
applied = models.DateTimeField(default=now)
+
class Meta:
app_cache = BaseAppCache()
app_label = "migrations"
View
1  django/forms/formsets.py
@@ -241,6 +241,7 @@ def ordered_forms(self):
# None should be sorted below anything else. Allowing None as
# a comparison value makes it so we can leave ordering fields
# blank.
+
def compare_ordering_key(k):
if k[1] is None:
return (1, 0) # +infinity, larger than any number
View
2  django/forms/models.py
@@ -602,6 +602,7 @@ def save(self, commit=True):
"""
if not commit:
self.saved_forms = []
+
def save_m2m():
for form in self.saved_forms:
form.save_m2m()
@@ -754,6 +755,7 @@ def add_fields(self, form, index):
# data back. Generally, pk.editable should be false, but for some
# reason, auto_created pk fields and AutoField's editable attribute is
# True, so check for that as well.
+
def pk_is_not_editable(pk):
return ((not pk.editable) or (pk.auto_created or isinstance(pk, AutoField))
or (pk.rel and pk.rel.parent_link and pk_is_not_editable(pk.rel.to._meta.pk)))
View
1  django/forms/widgets.py
@@ -406,6 +406,7 @@ def render(self, name, value, attrs=None):
class DateTimeBaseInput(TextInput):
format_key = ''
+
def __init__(self, attrs=None, format=None):
super(DateTimeBaseInput, self).__init__(attrs)
self.format = format if format else None
View
2  django/template/defaultfilters.py
@@ -591,6 +591,7 @@ def unordered_list(value, autoescape=None):
escaper = conditional_escape
else:
escaper = lambda x: x
+
def convert_old_style_list(list_):
"""
Converts old style lists to the new easier to understand format.
@@ -621,6 +622,7 @@ def convert_old_style_list(list_):
if old_style_list:
second_item = new_second_item
return [first_item, second_item], old_style_list
+
def _helper(list_, tabs=1):
indent = '\t' * tabs
output = []
View
2  django/test/utils.py
@@ -245,6 +245,7 @@ def compare_xml(want, got):
Based on http://codespeak.net/svn/lxml/trunk/src/lxml/doctestcompare.py
"""
_norm_whitespace_re = re.compile(r'[ \t\n][ \t\n]+')
+
def norm_whitespace(v):
return _norm_whitespace_re.sub(' ', v)
@@ -405,6 +406,7 @@ def patch_logger(logger_name, log_level):
and provides a simple mock-like list of messages received
"""
calls = []
+
def replacement(msg):
calls.append(msg)
logger = logging.getLogger(logger_name)
View
2  django/utils/decorators.py
@@ -30,6 +30,7 @@ def bound_func(*args2, **kwargs2):
# In case 'decorator' adds attributes to the function it decorates, we
# want to copy those. We don't have access to bound_func in this scope,
# but we can cheat by using it on a dummy function.
+
@decorator
def dummy(*args, **kwargs):
pass
@@ -84,6 +85,7 @@ def available_attrs(fn):
def make_middleware_decorator(middleware_class):
def _make_decorator(*m_args, **m_kwargs):
middleware = middleware_class(*m_args, **m_kwargs)
+
def _decorator(view_func):
@wraps(view_func, assigned=available_attrs(view_func))
def _wrapped_view(request, *args, **kwargs):
View
3  django/utils/feedgenerator.py
@@ -213,6 +213,7 @@ def __init__(self, url, length, mime_type):
class RssFeed(SyndicationFeed):
mime_type = 'application/rss+xml; charset=utf-8'
+
def write(self, outfile, encoding):
handler = SimplerXMLGenerator(outfile, encoding)
handler.startDocument()
@@ -255,6 +256,7 @@ def endChannelElement(self, handler):
class RssUserland091Feed(RssFeed):
_version = "0.91"
+
def add_item_elements(self, handler, item):
handler.addQuickElement("title", item['title'])
handler.addQuickElement("link", item['link'])
@@ -264,6 +266,7 @@ def add_item_elements(self, handler, item):
class Rss201rev2Feed(RssFeed):
# Spec: http://blogs.law.harvard.edu/tech/rss
_version = "2.0"
+
def add_item_elements(self, handler, item):
handler.addQuickElement("title", item['title'])
handler.addQuickElement("link", item['link'])
View
5 django/utils/html.py
@@ -118,12 +118,16 @@ def __init__(self):
HTMLParser.__init__(self)
self.reset()
self.fed = []
+
def handle_data(self, d):
self.fed.append(d)
+
def handle_entityref(self, name):
self.fed.append('&%s;' % name)
+
def handle_charref(self, name):
self.fed.append('&#%s;' % name)
+
def get_data(self):
return ''.join(self.fed)
@@ -285,6 +289,7 @@ def clean_html(text):
# Trim stupid HTML such as <br clear="all">.
text = html_gunk_re.sub('', text)
# Convert hard-coded bullets into HTML unordered lists.
+
def replace_p_tags(match):
s = match.group().replace('</p>', '</li>')
for d in DOTS:
View
6 django/utils/six.py
@@ -444,6 +444,7 @@ def iterlists(d, **kw):
if PY3:
def b(s):
return s.encode("latin-1")
+
def u(s):
return s
unichr = chr
@@ -462,14 +463,18 @@ def int2byte(i):
else:
def b(s):
return s
+
def u(s):
return unicode(s, "unicode_escape")
unichr = unichr
int2byte = chr
+
def byte2int(bs):
return ord(bs[0])
+
def indexbytes(buf, i):
return ord(buf[i])
+
def iterbytes(buf):
return (ord(byte) for byte in buf)
import StringIO
@@ -512,6 +517,7 @@ def print_(*args, **kwargs):
fp = kwargs.pop("file", sys.stdout)
if fp is None:
return
+
def write(data):
if not isinstance(data, basestring):
data = str(data)
View
1  django/utils/text.py
@@ -32,6 +32,7 @@ def wrap(text, width):
the text. Expects that existing line breaks are posix newlines.
"""
text = force_text(text)
+
def _generator():
it = iter(text.split(' '))
word = next(it)
View
4 setup.cfg
@@ -3,8 +3,8 @@ doc_files = docs extras AUTHORS INSTALL LICENSE README.rst
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,E226,E241,E251,E302,E501,E203,E231,E261,E301,F401,F403,W601
+exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py
+ignore=E124,E125,E127,E128,E226,E241,E251,E302,E501,E203,E231,E261,F401,F403,W601
[metadata]
license-file = LICENSE
View
1  tests/admin_scripts/complex_app/models/bar.py
@@ -5,5 +5,6 @@
class Bar(models.Model):
name = models.CharField(max_length=5)
+
class Meta:
app_label = 'complex_app'
View
1  tests/admin_scripts/complex_app/models/foo.py
@@ -3,5 +3,6 @@
class Foo(models.Model):
name = models.CharField(max_length=5)
+
class Meta:
app_label = 'complex_app'
View
1  tests/admin_scripts/tests.py
@@ -1342,6 +1342,7 @@ def test_base_run_from_argv(self):
Also test proper traceback display.
"""
command = BaseCommand()
+
def raise_command_error(*args, **kwargs):
raise CommandError("Custom error")
View
3  tests/admin_validation/tests.py
@@ -127,6 +127,7 @@ class TwoAlbumFKAndAnEInline(admin.TabularInline):
model = TwoAlbumFKAndAnE
exclude = ("e",)
fk_name = "album1"
+
class MyAdmin(admin.ModelAdmin):
inlines = [TwoAlbumFKAndAnEInline]
MyAdmin.validate(Album)
@@ -134,6 +135,7 @@ class MyAdmin(admin.ModelAdmin):
def test_inline_self_validation(self):
class TwoAlbumFKAndAnEInline(admin.TabularInline):
model = TwoAlbumFKAndAnE
+
class MyAdmin(admin.ModelAdmin):
inlines = [TwoAlbumFKAndAnEInline]
@@ -291,6 +293,7 @@ def test_non_model_first_field(self):
"""
class SongForm(forms.ModelForm):
extra_data = forms.CharField()
+
class Meta:
model = Song
fields = '__all__'
View
5 tests/admin_views/models.py
@@ -116,6 +116,7 @@ def get_absolute_url(self):
class Color(models.Model):
value = models.CharField(max_length=10)
warm = models.BooleanField(default=False)
+
def __str__(self):
return self.value
@@ -129,6 +130,7 @@ class Thing(models.Model):
title = models.CharField(max_length=20)
color = models.ForeignKey(Color, limit_choices_to={'warm': True})
pub_date = models.DateField(blank=True, null=True)
+
def __str__(self):
return self.title
@@ -138,6 +140,7 @@ class Actor(models.Model):
name = models.CharField(max_length=50)
age = models.IntegerField()
title = models.CharField(max_length=50, null=True, blank=True)
+
def __str__(self):
return self.name
@@ -199,6 +202,7 @@ class Persona(models.Model):
accounts which inherit from a common accounts class.
"""
name = models.CharField(blank=False, max_length=80)
+
def __str__(self):
return self.name
@@ -616,6 +620,7 @@ class AdminOrderedField(models.Model):
class AdminOrderedModelMethod(models.Model):
order = models.IntegerField()
stuff = models.CharField(max_length=200)
+
def some_order(self):
return self.order
some_order.admin_order_field = 'order'
View
2  tests/basic/tests.py
@@ -673,6 +673,7 @@ def test_emptyqs_values(self):
def test_emptyqs_customqs(self):
# A hacky test for custom QuerySet subclass - refs #17271
Article.objects.create(headline='foo', pub_date=datetime.now())
+
class CustomQuerySet(QuerySet):
def do_something(self):
return 'did something'
@@ -734,6 +735,7 @@ def test_concurrent_delete_with_save(self):
"""
a = Article.objects.create(headline='foo', pub_date=datetime.now())
exceptions = []
+
def deleter():
try:
# Do not delete a directly - doing so alters its state.
View
1  tests/cache/tests.py
@@ -1479,6 +1479,7 @@ def test_cache_key_with_non_ascii_tzname(self):
# Regression test for #17476
class CustomTzName(timezone.UTC):
name = ''
+
def tzname(self, dt):
return self.name
View
2  tests/custom_pk/models.py
@@ -19,6 +19,7 @@ class Employee(models.Model):
employee_code = models.IntegerField(primary_key=True, db_column = 'code')
first_name = models.CharField(max_length=20)
last_name = models.CharField(max_length=20)
+
class Meta:
ordering = ('last_name', 'first_name')
@@ -29,6 +30,7 @@ def __str__(self):
class Business(models.Model):
name = models.CharField(max_length=20, primary_key=True)
employees = models.ManyToManyField(Employee)
+
class Meta:
verbose_name_plural = 'businesses'
View
1  tests/decorators/tests.py
@@ -22,6 +22,7 @@ def fully_decorated(request):
def compose(*functions):
# compose(f, g)(*args, **kwargs) == f(g(*args, **kwargs))
functions = list(reversed(functions))
+
def _inner(*args, **kwargs):
result = functions[0](*args, **kwargs)
for f in functions[1:]:
View
2  tests/defaultfilters/tests.py
@@ -73,6 +73,7 @@ def test_floatformat(self):
class FloatWrapper(object):
def __init__(self, value):
self.value = value
+
def __float__(self):
return self.value
@@ -510,6 +511,7 @@ def test_unordered_list(self):
class ULItem(object):
def __init__(self, title):
self.title = title
+
def __str__(self):
return 'ulitem-%s' % str(self.title)
View
4 tests/delete/tests.py
@@ -65,6 +65,7 @@ def test_do_nothing(self):
# Testing DO_NOTHING is a bit harder: It would raise IntegrityError for a normal model,
# so we connect to pre_delete and set the fk to a known value.
replacement_r = R.objects.create()
+
def check_do_nothing(sender, **kwargs):
obj = kwargs['instance']
obj.donothing_set.update(donothing=replacement_r)
@@ -178,6 +179,7 @@ def test_bulk(self):
def test_instance_update(self):
deleted = []
related_setnull_sets = []
+
def pre_delete(sender, **kwargs):
obj = kwargs['instance']
deleted.append(obj)
@@ -264,6 +266,7 @@ def test_can_defer_constraint_checks(self):
# Attach a signal to make sure we will not do fast_deletes.
calls = []
+
def noop(*args, **kwargs):
calls.append('')
models.signals.post_delete.connect(noop, sender=User)
@@ -281,6 +284,7 @@ def test_cannot_defer_constraint_checks(self):
)
# Attach a signal to make sure we will not do fast_deletes.
calls = []
+
def noop(*args, **kwargs):
calls.append('')
models.signals.post_delete.connect(noop, sender=User)
View
1  tests/delete_regress/tests.py
@@ -148,6 +148,7 @@ def test_large_deletes(self):
for x in range(300):
Book.objects.create(pagecount=x+100)
# attach a signal to make sure we will not fast-delete
+
def noop(*args, **kwargs):
pass
models.signals.post_delete.connect(noop, sender=Book)
View
11 tests/deprecation/tests.py
@@ -26,6 +26,7 @@ def test_class_definition_warnings(self):
"""
with warnings.catch_warnings(record=True) as recorded:
warnings.simplefilter('always')
+
class Manager(six.with_metaclass(RenameManagerMethods)):
def old(self):
pass
@@ -40,6 +41,7 @@ def test_get_new_defined(self):
"""
with warnings.catch_warnings(record=True) as recorded:
warnings.simplefilter('ignore')
+
class Manager(six.with_metaclass(RenameManagerMethods)):
def new(self):
pass
@@ -59,6 +61,7 @@ def test_get_old_defined(self):
"""
with warnings.catch_warnings(record=True) as recorded:
warnings.simplefilter('ignore')
+
class Manager(six.with_metaclass(RenameManagerMethods)):
def old(self):
pass
@@ -79,9 +82,11 @@ def test_deprecated_subclass_renamed(self):
"""
with warnings.catch_warnings(record=True) as recorded:
warnings.simplefilter('ignore')
+
class Renamed(six.with_metaclass(RenameManagerMethods)):
def new(self):
pass
+
class Deprecated(Renamed):
def old(self):
super(Deprecated, self).old()
@@ -108,9 +113,11 @@ def test_renamed_subclass_deprecated(self):
"""
with warnings.catch_warnings(record=True) as recorded:
warnings.simplefilter('ignore')
+
class Deprecated(six.with_metaclass(RenameManagerMethods)):
def old(self):
pass
+
class Renamed(Deprecated):
def new(self):
super(Renamed, self).new()
@@ -132,15 +139,19 @@ class that renamed `old` and mixins that may or may not have renamed
"""
with warnings.catch_warnings(record=True) as recorded:
warnings.simplefilter('ignore')
+
class Renamed(six.with_metaclass(RenameManagerMethods)):
def new(self):
pass
+
class RenamedMixin(object):
def new(self):
super(RenamedMixin, self).new()
+
class DeprecatedMixin(object):
def old(self):
super(DeprecatedMixin, self).old()
+
class Deprecated(DeprecatedMixin, RenamedMixin, Renamed):
pass
warnings.simplefilter('always')
View
1  tests/expressions/tests.py
@@ -205,6 +205,7 @@ def test_filter(self):
test_gmbh.point_of_contact = None
test_gmbh.save()
self.assertTrue(test_gmbh.point_of_contact is None)
+
def test():
test_gmbh.point_of_contact = F("ceo")
self.assertRaises(ValueError, test)
View
4 tests/file_storage/tests.py
@@ -355,6 +355,7 @@ def test_file_chunks_error(self):
Test behaviour when file.chunks() is raising an error
"""
f1 = ContentFile('chunks fails')
+
def failing_chunks():
raise IOError
f1.chunks = failing_chunks
@@ -532,10 +533,13 @@ def test_closing_of_filenames(self):
class FileWrapper(object):
_closed = []
+
def __init__(self, f):
self.f = f
+
def __getattr__(self, name):
return getattr(self.f, name)
+
def close(self):
self._closed.append(True)
self.f.close()
View
1  tests/fixtures/models.py
@@ -68,6 +68,7 @@ def get_by_natural_key(self, name):
class Person(models.Model):
objects = PersonManager()
name = models.CharField(max_length=100)
+
def __str__(self):
return self.name
View
2  tests/forms_tests/tests/test_extra.py
@@ -663,11 +663,13 @@ class TestU:
if six.PY3:
def __str__(self):
return 'ŠĐĆŽćžšđ'
+
def __bytes__(self):
return b'Foo'
else:
def __str__(self):
return b'Foo'
+
def __unicode__(self):
return '\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111'
View
1  tests/forms_tests/tests/test_fields.py
@@ -991,6 +991,7 @@ def test_nullbooleanfield_4(self):
# Make sure we're compatible with MySQL, which uses 0 and 1 for its boolean
# values. (#9609)
NULLBOOL_CHOICES = (('1', 'Yes'), ('0', 'No'), ('', 'Unknown'))
+
class MySQLNullBooleanForm(Form):
nullbool0 = NullBooleanField(widget=RadioSelect(choices=NULLBOOL_CHOICES))
nullbool1 = NullBooleanField(widget=RadioSelect(choices=NULLBOOL_CHOICES))
View
2  tests/forms_tests/tests/test_forms.py
@@ -824,6 +824,7 @@ def test_validators_independence(self):
""" Test that we are able to modify a form field validators list without polluting
other forms """
from django.core.validators import MaxValueValidator
+
class MyForm(Form):
myfield = CharField(max_length=25)
@@ -1899,6 +1900,7 @@ def test_custom_empty_values(self):
"""
class CustomJSONField(CharField):
empty_values = [None, '']
+
def to_python(self, value):
# Fake json.loads
if value == '{}':
View
2  tests/forms_tests/tests/test_media.py
@@ -429,6 +429,7 @@ class AnotherForm(Form):
class FormWithMedia(Form):
field1 = CharField(max_length=20, widget=MyWidget1())
field2 = CharField(max_length=20, widget=MyWidget2())
+
class Media:
js = ('/some/form/javascript',)
css = {
@@ -880,6 +881,7 @@ class AnotherForm(Form):
class FormWithMedia(Form):
field1 = CharField(max_length=20, widget=MyWidget1())
field2 = CharField(max_length=20, widget=MyWidget2())
+
class Media:
js = ('/some/form/javascript',)
css = {
View
4 tests/forms_tests/tests/test_widgets.py
@@ -273,6 +273,7 @@ def test_select(self):
# The 'choices' argument can be any iterable:
from itertools import chain
+
def get_choices():
for i in range(5):
yield (i, i)
@@ -284,6 +285,7 @@ def get_choices():
<option value="4">4</option>
</select>""")
things = ({'id': 1, 'name': 'And Boom'}, {'id': 2, 'name': 'One More Thing!'})
+
class SomeForm(Form):
somechoice = ChoiceField(choices=chain((('', '-'*9),), [(thing['id'], thing['name']) for thing in things]))
f = SomeForm()
@@ -903,6 +905,7 @@ def decompress(self, value):
if value:
return value.split('__')
return ['', '']
+
def format_output(self, rendered_widgets):
return '<br />'.join(rendered_widgets)
@@ -1066,6 +1069,7 @@ def _set_choices(self, choices):
When choices are set for this widget, we want to pass those along to the Select widget
"""
self.widgets[0].choices = choices
+
def _get_choices(self):
"""
The choices for this widget are the Select widget's choices
View
1  tests/generic_relations_regress/tests.py
@@ -95,6 +95,7 @@ def test_generic_relation_ordering(self):
Link.objects.create(content_object=c)
places = list(Place.objects.order_by('links__id'))
+
def count_places(place):
return len([p for p in places if p.id == place.id])
View
1  tests/generic_views/views.py
@@ -242,6 +242,7 @@ class BookSigningConfig(object):
model = BookSigning
date_field = 'event_date'
# use the same templates as for books
+
def get_template_names(self):
return ['generic_views/book%s.html' % self.template_name_suffix]
View
1  tests/inspectdb/tests.py
@@ -38,6 +38,7 @@ def test_field_types(self):
table_name_filter=lambda tn:tn.startswith('inspectdb_columntypes'),
stdout=out)
output = out.getvalue()
+
def assertFieldType(name, definition):
out_def = re.search(r'^\s*%s = (models.*)$' % name, output, re.MULTILINE).groups()[0]
self.assertEqual(definition, out_def)
View
3  tests/lookup/models.py
@@ -13,6 +13,7 @@
class Author(models.Model):
name = models.CharField(max_length=100)
+
class Meta:
ordering = ('name', )
@@ -21,6 +22,7 @@ class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateTimeField()
author = models.ForeignKey(Author, blank=True, null=True)
+
class Meta:
ordering = ('-pub_date', 'headline')
@@ -30,6 +32,7 @@ def __str__(self):
class Tag(models.Model):
articles = models.ManyToManyField(Article)
name = models.CharField(max_length=100)
+
class Meta:
ordering = ('name', )
View
2  tests/middleware/tests.py
@@ -329,6 +329,7 @@ def test_custom_request_checker(self):
class SubclassedMiddleware(BrokenLinkEmailsMiddleware):
ignored_user_agent_patterns = (re.compile(r'Spider.*'),
re.compile(r'Robot.*'))
+
def is_ignorable_request(self, request, uri, domain, referer):
'''Check user-agent in addition to normal checks.'''
if super(SubclassedMiddleware, self).is_ignorable_request(request, uri, domain, referer):
@@ -347,6 +348,7 @@ def is_ignorable_request(self, request, uri, domain, referer):
class ConditionalGetMiddlewareTest(TestCase):
urls = 'middleware.cond_get_urls'
+
def setUp(self):
self.req = HttpRequest()
self.req.META = {
View
1  tests/migrations/test_operations.py
@@ -347,6 +347,7 @@ def test_run_python(self):
with self.assertRaises(NotImplementedError):
operation.database_backwards("test_runpython", None, new_state, project_state)
# Now test we can do it with a callable
+
def inner_method(models, schema_editor):
Pony = models.get_model("test_runpython", "Pony")
Pony.objects.create(pink=1, weight=3.55)
View
2  tests/migrations/test_state.py
@@ -20,6 +20,7 @@ class Author(models.Model):
name = models.CharField(max_length=255)
bio = models.TextField()
age = models.IntegerField(blank=True, null=True)
+
class Meta:
app_label = "migrations"
app_cache = new_app_cache
@@ -35,6 +36,7 @@ class Meta:
class Book(models.Model):
title = models.CharField(max_length=1000)
author = models.ForeignKey(Author)
+
class Meta:
app_label = "migrations"
app_cache = new_app_cache
View
1  tests/model_forms/models.py
@@ -211,6 +211,7 @@ class DerivedBook(Book, BookXtra):
class ExplicitPK(models.Model):
key = models.CharField(max_length=20, primary_key=True)
desc = models.CharField(max_length=20, blank=True, unique=True)
+
class Meta:
unique_together = ('key', 'desc')
View
3  tests/model_forms/tests.py
@@ -26,6 +26,7 @@
if test_images:
from .models import ImageFile, OptionalImageFile
+
class ImageFileForm(forms.ModelForm):
class Meta:
model = ImageFile
@@ -208,6 +209,7 @@ class Media:
css = {
'all': ('/some/form/css',)
}
+
class Meta:
model = TextFile
fields = '__all__'
@@ -1722,6 +1724,7 @@ def test_foreignkeys_which_use_to_field(self):
class CategoryForm(forms.ModelForm):
description = forms.CharField()
+
class Meta:
model = Category
fields = ['description', 'url']
View
1  tests/model_forms_regress/tests.py
@@ -35,6 +35,7 @@ def test_model_multiple_choice_run_validators(self):
Person.objects.create(name="Person %s" % i)
self._validator_run = False
+
def my_validator(value):
self._validator_run = True
View
2  tests/model_formsets/tests.py
@@ -1075,9 +1075,11 @@ def test_callable_defaults(self):
class MembershipForm(forms.ModelForm):
date_joined = forms.SplitDateTimeField(initial=now)
+
class Meta:
model = Membership
fields = "__all__"
+
def __init__(self, **kwargs):
super(MembershipForm, self).__init__(**kwargs)
self.fields['date_joined'].widget = forms.SplitDateTimeWidget()
View
1  tests/model_inheritance_regress/models.py
@@ -86,6 +86,7 @@ class SelfRefChild(SelfRefParent):
class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateTimeField()
+
class Meta:
ordering = ('-pub_date', 'headline')
View
2  tests/modeladmin/tests.py
@@ -1029,8 +1029,10 @@ class ValidationTestModelAdmin(ModelAdmin):
class AwesomeFilter(SimpleListFilter):
def get_title(self):
return 'awesomeness'
+
def get_choices(self, request):
return (('bit', 'A bit awesome'), ('very', 'Very awesome'), )
+
def get_queryset(self, cl, qs):
return qs
View
1  tests/one_to_one/tests.py
@@ -85,6 +85,7 @@ def test_foreign_key(self):
w = self.r.waiter_set.create(name='Joe')
w.save()
self.assertEqual(repr(w), '<Waiter: Joe the waiter at Demon Dogs the restaurant>')
+
# Query the waiters
def assert_filter_waiters(**params):
self.assertQuerysetEqual(Waiter.objects.filter(**params), [
View
2  tests/ordering/models.py
@@ -21,6 +21,7 @@
class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateTimeField()
+
class Meta:
ordering = ('-pub_date', 'headline')
@@ -31,6 +32,7 @@ def __str__(self):
class ArticlePKOrdering(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateTimeField()
+
class Meta:
ordering = ('-pk',)
View
3  tests/queries/tests.py
@@ -676,6 +676,7 @@ def test_tickets_7448_7707(self):
Item.objects.filter(created__in=[self.time1, self.time2]),
['<Item: one>', '<Item: two>']
)
+
def test_ticket7235(self):
# An EmptyQuerySet should not raise exceptions if it is filtered.
Eaten.objects.create(meal='m')
@@ -757,6 +758,7 @@ def test_ticket10432(self):
def f():
return iter([])
n_obj = Note.objects.all()[0]
+
def g():
for i in [n_obj.pk]:
yield i
@@ -1238,6 +1240,7 @@ def test_ticket7759(self):
# Count should work with a partially read result set.
count = Number.objects.count()
qs = Number.objects.all()
+
def run():
for obj in qs:
return qs.count() == count
View
1  tests/requests/tests.py
@@ -719,6 +719,7 @@ def test_request_finished_failed_connection(self):
connection.enter_transaction_management()
connection.set_dirty()
+
# Test that the rollback doesn't succeed (for example network failure
# could cause this).
def fail_horribly():
View
1  tests/select_for_update/tests.py
@@ -220,6 +220,7 @@ def test_raw_lock_not_available(self):
raises the correct exception
"""
self.start_blocking_transaction()
+
def raw(status):
try:
list(
View
9 tests/select_related/models.py
@@ -15,6 +15,7 @@
@python_2_unicode_compatible
class Domain(models.Model):
name = models.CharField(max_length=50)
+
def __str__(self):
return self.name
@@ -22,6 +23,7 @@ def __str__(self):
class Kingdom(models.Model):
name = models.CharField(max_length=50)
domain = models.ForeignKey(Domain)
+
def __str__(self):
return self.name
@@ -29,6 +31,7 @@ def __str__(self):
class Phylum(models.Model):
name = models.CharField(max_length=50)
kingdom = models.ForeignKey(Kingdom)
+
def __str__(self):
return self.name
@@ -36,6 +39,7 @@ def __str__(self):
class Klass(models.Model):
name = models.CharField(max_length=50)
phylum = models.ForeignKey(Phylum)
+
def __str__(self):
return self.name
@@ -43,6 +47,7 @@ def __str__(self):
class Order(models.Model):
name = models.CharField(max_length=50)
klass = models.ForeignKey(Klass)
+
def __str__(self):
return self.name
@@ -50,6 +55,7 @@ def __str__(self):
class Family(models.Model):
name = models.CharField(max_length=50)
order = models.ForeignKey(Order)
+
def __str__(self):
return self.name
@@ -57,6 +63,7 @@ def __str__(self):
class Genus(models.Model):
name = models.CharField(max_length=50)
family = models.ForeignKey(Family)
+
def __str__(self):
return self.name
@@ -64,6 +71,7 @@ def __str__(self):
class Species(models.Model):
name = models.CharField(max_length=50)
genus = models.ForeignKey(Genus)
+
def __str__(self):
return self.name
@@ -73,5 +81,6 @@ class HybridSpecies(models.Model):
name = models.CharField(max_length=50)
parent_1 = models.ForeignKey(Species, related_name='child_1')
parent_2 = models.ForeignKey(Species, related_name='child_2')
+
def __str__(self):
return self.name
View
1  tests/serializers_regress/models.py
@@ -258,6 +258,7 @@ def save(self, *args, **kwargs):
# Regression for #7202, #7350
class AbstractBaseModel(models.Model):
parent_data = models.IntegerField()
+
class Meta:
abstract = True
View
2  tests/tablespaces/models.py
@@ -18,6 +18,7 @@ class ArticleRef(models.Model):
class Scientist(models.Model):
name = models.CharField(max_length=50)
+
class Meta:
db_table = 'tablespaces_scientistref'
db_tablespace = 'tbl_tbsp'
@@ -28,6 +29,7 @@ class Article(models.Model):
code = models.CharField(max_length=50, unique=True, db_tablespace='idx_tbsp')
authors = models.ManyToManyField(Scientist, related_name='articles_written_set')
reviewers = models.ManyToManyField(Scientist, related_name='articles_reviewed_set', db_tablespace='idx_tbsp')
+
class Meta:
db_table = 'tablespaces_articleref'
db_tablespace = 'tbl_tbsp'
View
7 tests/template_tests/test_callables.py
@@ -12,6 +12,7 @@ class Doodad(object):
def __init__(self, value):
self.num_calls = 0
self.value = value
+
def __call__(self):
self.num_calls += 1
return {"the_value": self.value}
@@ -38,9 +39,11 @@ def test_alters_data(self):
class Doodad(object):
alters_data = True
+
def __init__(self, value):
self.num_calls = 0
self.value = value
+
def __call__(self):
self.num_calls += 1
return {"the_value": self.value}
@@ -63,9 +66,11 @@ def test_do_not_call(self):
class Doodad(object):
do_not_call_in_templates = True
+
def __init__(self, value):
self.num_calls = 0
self.value = value
+
def __call__(self):
self.num_calls += 1
return {"the_value": self.value}
@@ -94,9 +99,11 @@ def test_do_not_call_and_alters_data(self):
class Doodad(object):
do_not_call_in_templates = True
alters_data = True
+
def __init__(self, value):
self.num_calls = 0
self.value = value
+
def __call__(self):
self.num_calls += 1
return {"the_value": self.value}
View
5 tests/template_tests/test_parser.py
@@ -102,18 +102,23 @@ def test_compile_filter_error(self):
def test_filter_args_count(self):
p = Parser("")
l = Library()
+
@l.filter
def no_arguments(value):
pass
+
@l.filter
def one_argument(value, arg):
pass
+
@l.filter
def one_opt_argument(value, arg=False):
pass
+
@l.filter
def two_arguments(value, arg, arg2):
pass
+
@l.filter
def two_one_opt_arg(value, arg, arg2=False):
pass
View
1  tests/template_tests/test_response.py
@@ -134,6 +134,7 @@ def test_post_callbacks(self):
def post1(obj):
post.append('post1')
+
def post2(obj):
post.append('post2')
View
1  tests/template_tests/tests.py
@@ -149,6 +149,7 @@ class TemplateLoaderTests(TestCase):
def test_loaders_security(self):
ad_loader = app_directories.Loader()
fs_loader = filesystem.Loader()
+
def test_template_sources(path, template_dirs, expected_sources):
if isinstance(expected_sources, list):
# Fix expected sources so they are abspathed
View
2  tests/test_client_regress/tests.py
@@ -547,6 +547,7 @@ def test_unknown_nonfield_error(self):
class AssertFormsetErrorTests(TestCase):
msg_prefixes = [("", {}), ("abc: ", {"msg_prefix": "abc"})]
+
def setUp(self):
"""Makes response object for testing field and non-field errors"""
# For testing field and non-field errors
@@ -1201,6 +1202,7 @@ def test_unicode_payload_non_utf(self):
class DummyFile(object):
def __init__(self, filename):
self.name = filename
+
def read(self):
return b'TEST_FILE_CONTENT'
View
1  tests/transactions_regress/tests.py
@@ -374,6 +374,7 @@ def test_savepoint_rollback(self):
if (connection.vendor == 'mysql' and
connection.features._mysql_storage_engine == 'MyISAM'):
raise SkipTest("MyISAM MySQL storage engine doesn't support savepoints")
+
@commit_manually
def work():
mod = Mod.objects.create(fld=1)
View
4 tests/update_only_fields/tests.py
@@ -192,10 +192,12 @@ def test_update_fields_inheritance_with_proxy_model(self):
def test_update_fields_signals(self):
p = Person.objects.create(name='Sara', gender='F')
pre_save_data = []
+
def pre_save_receiver(**kwargs):
pre_save_data.append(kwargs['update_fields'])
pre_save.connect(pre_save_receiver)
post_save_data = []
+
def post_save_receiver(**kwargs):
post_save_data.append(kwargs['update_fields'])
post_save.connect(post_save_receiver)
@@ -222,10 +224,12 @@ def test_update_fields_incorrect_params(self):
def test_empty_update_fields(self):
s = Person.objects.create(name='Sara', gender='F')
pre_save_data = []
+
def pre_save_receiver(**kwargs):
pre_save_data.append(kwargs['update_fields'])
pre_save.connect(pre_save_receiver)
post_save_data = []
+
def post_save_receiver(**kwargs):
post_save_data.append(kwargs['update_fields'])
post_save.connect(post_save_receiver)
View
1  tests/utils_tests/test_functional.py
@@ -28,6 +28,7 @@ class A(object):
def _get_do(self):
raise NotImplementedError
+
def _set_do(self, value):
raise NotImplementedError
do = lazy_property(_get_do, _set_do)
View
2  tests/validators/tests.py
@@ -184,6 +184,7 @@
def create_simple_test_method(validator, expected, value, num):
if expected is not None and issubclass(expected, Exception):
test_mask = 'test_%s_raises_error_%d'
+
def test_func(self):
# assertRaises not used, so as to be able to produce an error message
# containing the tested value
@@ -196,6 +197,7 @@ def test_func(self):
expected.__name__, value))
else:
test_mask = 'test_%s_%d'
+
def test_func(self):
try:
self.assertEqual(expected, validator(value))
View
1  tests/wsgi/tests.py
@@ -76,6 +76,7 @@ def test_default(self):
"""
# Mock out get_wsgi_application so we know its return value is used
fake_app = object()
+
def mock_get_wsgi_app():
return fake_app
from django.core.servers import basehttp

0 comments on commit c3aa294

Please sign in to comment.
Something went wrong with that request. Please try again.