From bab9123daa5d05150951f74183906a76d2b0cf27 Mon Sep 17 00:00:00 2001 From: Alasdair Nicol Date: Fri, 18 Oct 2013 00:58:02 +0100 Subject: [PATCH] Fixed #21268 -- Fixed E303 pep8 warnings --- django/contrib/admin/templatetags/admin_list.py | 1 - django/contrib/auth/tests/test_auth_backends.py | 1 - django/contrib/auth/tests/test_views.py | 1 - django/contrib/contenttypes/tests.py | 1 - django/contrib/formtools/preview.py | 1 - django/contrib/formtools/tests/tests.py | 1 - django/contrib/gis/geos/tests/test_mutable_list.py | 1 - django/contrib/gis/tests/test_measure.py | 1 - django/contrib/sessions/tests.py | 1 - django/contrib/sitemaps/tests/test_http.py | 1 - django/core/handlers/base.py | 1 - django/core/urlresolvers.py | 1 - django/forms/models.py | 1 - django/test/runner.py | 1 - django/utils/six.py | 6 ------ setup.cfg | 2 +- tests/admin_changelist/tests.py | 1 - tests/admin_inlines/tests.py | 1 - tests/admin_scripts/management/commands/noargs_command.py | 1 - tests/admin_validation/tests.py | 2 -- tests/admin_widgets/tests.py | 1 - tests/app_loading/tests.py | 5 ----- tests/cache/tests.py | 2 -- tests/custom_managers/tests.py | 1 - tests/defaultfilters/tests.py | 2 -- tests/delete_regress/tests.py | 4 ---- tests/files/tests.py | 1 - tests/fixtures_model_package/tests.py | 1 - tests/fixtures_regress/tests.py | 1 - tests/forms_tests/tests/test_extra.py | 1 - tests/forms_tests/tests/test_fields.py | 4 ---- tests/forms_tests/tests/test_forms.py | 1 - tests/forms_tests/tests/test_formsets.py | 2 -- tests/generic_relations/tests.py | 1 - tests/generic_views/test_dates.py | 1 - tests/generic_views/test_edit.py | 1 - tests/http_utils/tests.py | 1 - tests/i18n/tests.py | 1 - tests/m2m_through/tests.py | 2 -- tests/middleware/tests.py | 1 - tests/model_forms/tests.py | 4 ---- tests/model_forms_regress/tests.py | 1 - tests/multiple_database/tests.py | 5 ----- tests/nested_foreign_keys/tests.py | 5 ----- tests/or_lookups/tests.py | 1 - tests/prefetch_related/tests.py | 1 - tests/queries/tests.py | 1 - tests/requests/tests.py | 1 - tests/select_related_regress/tests.py | 1 - tests/template_tests/test_response.py | 1 - tests/template_tests/tests.py | 3 +-- tests/transactions/tests.py | 1 - tests/wsgi/tests.py | 3 --- 53 files changed, 2 insertions(+), 87 deletions(-) diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index f1c11831ab0c0..4e0af56312abe 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -155,7 +155,6 @@ def result_headers(cl): if i not in ordering_field_columns: o_list_primary.insert(0, make_qs_param(new_order_type, i)) - yield { "text": text, "sortable": True, diff --git a/django/contrib/auth/tests/test_auth_backends.py b/django/contrib/auth/tests/test_auth_backends.py index 280d760afb301..ce829e575e0f1 100644 --- a/django/contrib/auth/tests/test_auth_backends.py +++ b/django/contrib/auth/tests/test_auth_backends.py @@ -236,7 +236,6 @@ def test_authenticate(self): self.assertEqual(test_user, authenticated_user) - class TestObj(object): pass diff --git a/django/contrib/auth/tests/test_views.py b/django/contrib/auth/tests/test_views.py index d9a848bdd23a4..dc2e9852483ef 100644 --- a/django/contrib/auth/tests/test_views.py +++ b/django/contrib/auth/tests/test_views.py @@ -198,7 +198,6 @@ def test_poisoned_http_host_admin_site(self): self.assertEqual(len(mail.outbox), 0) self.assertEqual(len(logger_calls), 1) - def _test_confirm_start(self): # Start by creating the email self.client.post('/password_reset/', {'email': 'staffmember@example.com'}) diff --git a/django/contrib/contenttypes/tests.py b/django/contrib/contenttypes/tests.py index f300294cd6976..3f648bd456f49 100644 --- a/django/contrib/contenttypes/tests.py +++ b/django/contrib/contenttypes/tests.py @@ -203,7 +203,6 @@ def test_get_for_concrete_models(self): DeferredProxyModel: proxy_model_ct, }) - @override_settings(ALLOWED_HOSTS=['example.com']) def test_shortcut_view(self): """ diff --git a/django/contrib/formtools/preview.py b/django/contrib/formtools/preview.py index 53b0da6e8e479..2ef7b6d1464f8 100644 --- a/django/contrib/formtools/preview.py +++ b/django/contrib/formtools/preview.py @@ -101,7 +101,6 @@ def get_context(self, request, form): "Context for template rendering." return {'form': form, 'stage_field': self.unused_name('stage'), 'state': self.state} - def parse_params(self, *args, **kwargs): """ Given captured args and kwargs from the URLconf, saves something in diff --git a/django/contrib/formtools/tests/tests.py b/django/contrib/formtools/tests/tests.py index e1e6ab860badc..fff483ce386b6 100644 --- a/django/contrib/formtools/tests/tests.py +++ b/django/contrib/formtools/tests/tests.py @@ -139,7 +139,6 @@ def test_form_submit_good_hash(self): response = self.client.post('/preview/', self.test_data) self.assertEqual(response.content, success_string_encoded) - def test_form_submit_bad_hash(self): """ Test contrib.formtools.preview form submittal does not proceed diff --git a/django/contrib/gis/geos/tests/test_mutable_list.py b/django/contrib/gis/geos/tests/test_mutable_list.py index 3cf1daf12a087..d6ca2f66ec8b1 100644 --- a/django/contrib/gis/geos/tests/test_mutable_list.py +++ b/django/contrib/gis/geos/tests/test_mutable_list.py @@ -145,7 +145,6 @@ def setfcn(x,i,j,k,L): pl[::k] = ssl self.assertEqual(pl, ul[:], 'set slice [::%d]' % (k)) - def test03_delslice(self): 'Delete slice' for Len in range(self.limit): diff --git a/django/contrib/gis/tests/test_measure.py b/django/contrib/gis/tests/test_measure.py index 131e1ba7aa91b..21870b6f0ccad 100644 --- a/django/contrib/gis/tests/test_measure.py +++ b/django/contrib/gis/tests/test_measure.py @@ -32,7 +32,6 @@ def testInit(self): self.assertEqual(d.m, 1.0) self.assertEqual(d.mm, 1000.0) - def testInitInvalid(self): "Testing initialisation from invalid units" self.assertRaises(AttributeError, D, banana=100) diff --git a/django/contrib/sessions/tests.py b/django/contrib/sessions/tests.py index 0b10e14530c95..275eba57136d8 100644 --- a/django/contrib/sessions/tests.py +++ b/django/contrib/sessions/tests.py @@ -284,7 +284,6 @@ def test_decode_failure_logged_to_security(self): self.assertEqual(len(calls), 1) self.assertTrue('corrupted' in calls[0]) - def test_actual_expiry(self): # this doesn't work with JSONSerializer (serializing timedelta) with override_settings(SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer'): diff --git a/django/contrib/sitemaps/tests/test_http.py b/django/contrib/sitemaps/tests/test_http.py index 6d6862e0a6d2b..aba3e736c27ec 100644 --- a/django/contrib/sitemaps/tests/test_http.py +++ b/django/contrib/sitemaps/tests/test_http.py @@ -42,7 +42,6 @@ def test_simple_sitemap_custom_index(self): """ % self.base_url self.assertXMLEqual(response.content.decode('utf-8'), expected_content) - def test_simple_sitemap_section(self): "A simple sitemap section can be rendered" response = self.client.get('/simple/sitemap-simple.xml') diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py index fe7abed90377c..9679ae88dc7e0 100644 --- a/django/core/handlers/base.py +++ b/django/core/handlers/base.py @@ -30,7 +30,6 @@ class BaseHandler(object): def __init__(self): self._request_middleware = self._view_middleware = self._template_response_middleware = self._response_middleware = self._exception_middleware = None - def load_middleware(self): """ Populate middleware lists from settings.MIDDLEWARE_CLASSES. diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index 14fc2822815cc..e3f1e3ecb5206 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -156,7 +156,6 @@ def __init__(self, regex): self._regex = regex self._regex_dict = {} - @property def regex(self): """ diff --git a/django/forms/models.py b/django/forms/models.py index 1a6e7d2a7afe6..3b01e9b6c7382 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -840,7 +840,6 @@ def initial_form_count(self): return 0 return super(BaseInlineFormSet, self).initial_form_count() - def _construct_form(self, i, **kwargs): form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs) if self.save_as_new: diff --git a/django/test/runner.py b/django/test/runner.py index 700a52c775d32..fd0bfe8cb03c3 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -89,7 +89,6 @@ def build_suite(self, test_labels=None, extra_tests=None, **kwargs): break kwargs['top_level_dir'] = top_level - if not (tests and tests.countTestCases()): # if no tests found, it's probably a package; try discovery tests = self.test_loader.discover(start_dir=label, **kwargs) diff --git a/django/utils/six.py b/django/utils/six.py index e3720b1308370..b5f0162393aa3 100644 --- a/django/utils/six.py +++ b/django/utils/six.py @@ -130,7 +130,6 @@ def _resolve(self): return getattr(module, self.attr) - class _MovedItems(types.ModuleType): """Lazy loading of moved objects""" @@ -198,7 +197,6 @@ class _MovedItems(types.ModuleType): moves = sys.modules[__name__ + ".moves"] = _MovedItems(__name__ + ".moves") - class Module_six_moves_urllib_parse(types.ModuleType): """Lazy loading of moved objects in six.moves.urllib_parse""" @@ -484,13 +482,11 @@ def iterbytes(buf): import builtins exec_ = getattr(builtins, "exec") - def reraise(tp, value, tb=None): if value.__traceback__ is not tb: raise value.with_traceback(tb) raise value - print_ = getattr(builtins, "print") del builtins @@ -507,12 +503,10 @@ def exec_(_code_, _globs_=None, _locs_=None): _locs_ = _globs_ exec("""exec _code_ in _globs_, _locs_""") - exec_("""def reraise(tp, value, tb=None): raise tp, value, tb """) - def print_(*args, **kwargs): """The new-style print function.""" fp = kwargs.pop("file", sys.stdout) diff --git a/setup.cfg b/setup.cfg index 49ce1725d81d6..e9679c50d5b3d 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=E123,E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,E303,F401,F403,F841,W601 +ignore=E123,E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,F401,F403,F841,W601 [metadata] license-file = LICENSE diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py index ec62a02f3bd4a..4819dfe4d947f 100644 --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -73,7 +73,6 @@ def test_select_related_as_empty_tuple(self): ia.list_max_show_all, ia.list_editable, ia) self.assertEqual(cl.queryset.query.select_related, False) - def test_result_list_empty_changelist_value(self): """ Regression test for #14982: EMPTY_CHANGELIST_VALUE should be honored diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index 6dfef9695abb9..8f0765d7a3b41 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -513,7 +513,6 @@ def test_inline_change_fk_change_del_perm(self): 'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True) self.assertContains(response, 'id="id_inner2_set-0-DELETE"') - def test_inline_change_fk_all_perms(self): permission = Permission.objects.get(codename='add_inner2', content_type=self.inner_ct) self.user.user_permissions.add(permission) diff --git a/tests/admin_scripts/management/commands/noargs_command.py b/tests/admin_scripts/management/commands/noargs_command.py index 9652099f9bace..e94807f2e2b7d 100644 --- a/tests/admin_scripts/management/commands/noargs_command.py +++ b/tests/admin_scripts/management/commands/noargs_command.py @@ -5,6 +5,5 @@ class Command(NoArgsCommand): help = "Test No-args commands" requires_model_validation = False - def handle_noargs(self, **options): print('EXECUTE:NoArgsCommand options=%s' % sorted(options.items())) diff --git a/tests/admin_validation/tests.py b/tests/admin_validation/tests.py index 8096d486d38a6..0deb80c0efda5 100644 --- a/tests/admin_validation/tests.py +++ b/tests/admin_validation/tests.py @@ -131,7 +131,6 @@ class MyAdmin(admin.ModelAdmin): inlines = [TwoAlbumFKAndAnEInline] MyAdmin.validate(Album) - def test_inline_self_validation(self): class TwoAlbumFKAndAnEInline(admin.TabularInline): model = TwoAlbumFKAndAnE @@ -296,7 +295,6 @@ class Meta: model = Song fields = '__all__' - class FieldsOnFormOnlyAdmin(admin.ModelAdmin): form = SongForm fields = ['extra_data', 'title'] diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 360902cf6853a..56b58807276be 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -860,7 +860,6 @@ def test_filter(self): self.selenium.get( '%s%s' % (self.live_server_url, '/admin_widgets/school/%s/' % self.school.id)) - for field_name in ['students', 'alumni']: from_box = '#id_%s_from' % field_name to_box = '#id_%s_to' % field_name diff --git a/tests/app_loading/tests.py b/tests/app_loading/tests.py index dc25899646777..1c2502bbcf7c8 100644 --- a/tests/app_loading/tests.py +++ b/tests/app_loading/tests.py @@ -96,29 +96,24 @@ def setUp(self): from .not_installed import models self.not_installed_module = models - def test_get_model_only_returns_installed_models(self): self.assertEqual( get_model("not_installed", "NotInstalledModel"), None) - def test_get_model_with_not_installed(self): self.assertEqual( get_model( "not_installed", "NotInstalledModel", only_installed=False), self.not_installed_module.NotInstalledModel) - def test_get_models_only_returns_installed_models(self): self.assertFalse( "NotInstalledModel" in [m.__name__ for m in get_models()]) - def test_get_models_with_app_label_only_returns_installed_models(self): self.assertEqual(get_models(self.not_installed_module), []) - def test_get_models_with_not_installed(self): self.assertTrue( "NotInstalledModel" in [ diff --git a/tests/cache/tests.py b/tests/cache/tests.py index a8b23f139db49..b107cdb3fea7a 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -794,7 +794,6 @@ def test_custom_key_func(self): self.assertEqual(self.custom_key_cache.get('answer2'), 42) self.assertEqual(self.custom_key_cache2.get('answer2'), 42) - def test_cache_write_unpickable_object(self): update_middleware = UpdateCacheMiddleware() update_middleware.cache = self.cache @@ -1496,7 +1495,6 @@ def tzname(self, dt): self.assertIn(sanitized_name, learn_cache_key(request, response), "Cache keys should include the time zone name when time zones are active") - @override_settings( CACHE_MIDDLEWARE_KEY_PREFIX="test", CACHE_MIDDLEWARE_SECONDS=60, diff --git a/tests/custom_managers/tests.py b/tests/custom_managers/tests.py index f9a9f33d87852..021decc45564b 100644 --- a/tests/custom_managers/tests.py +++ b/tests/custom_managers/tests.py @@ -68,7 +68,6 @@ def test_manager(self): # manager self.assertIsInstance(self.p2.books, PublishedBookManager) - # The default manager, "objects", doesn't exist, because a custom one # was provided. self.assertRaises(AttributeError, lambda: Book.objects) diff --git a/tests/defaultfilters/tests.py b/tests/defaultfilters/tests.py index f347ceef3f30e..dd4c696bebe7c 100644 --- a/tests/defaultfilters/tests.py +++ b/tests/defaultfilters/tests.py @@ -82,7 +82,6 @@ def __float__(self): finally: decimal_ctx.prec = old_prec - def test_floatformat_py2_fail(self): self.assertEqual(floatformat(1.00000000000000015, 16), '1.0000000000000002') @@ -92,7 +91,6 @@ def test_floatformat_py2_fail(self): if six.PY2: test_floatformat_py2_fail = unittest.expectedFailure(test_floatformat_py2_fail) - def test_addslashes(self): self.assertEqual(addslashes('"double quotes" and \'single quotes\''), '\\"double quotes\\" and \\\'single quotes\\\'') diff --git a/tests/delete_regress/tests.py b/tests/delete_regress/tests.py index 7fbb09f43933e..95e39cbbf8c72 100644 --- a/tests/delete_regress/tests.py +++ b/tests/delete_regress/tests.py @@ -178,7 +178,6 @@ def create_image(self): return test_image - def test_delete_proxy(self): """ Deleting the *proxy* instance bubbles through to its non-proxy and @@ -197,7 +196,6 @@ def test_delete_proxy(self): self.assertEqual(len(FooImage.objects.all()), 0) self.assertEqual(len(FooFile.objects.all()), 0) - def test_delete_proxy_of_proxy(self): """ Deleting a proxy-of-proxy instance should bubble through to its proxy @@ -224,7 +222,6 @@ def test_delete_proxy_of_proxy(self): self.assertEqual(len(FooFile.objects.all()), 0) self.assertEqual(len(FooImage.objects.all()), 0) - def test_delete_concrete_parent(self): """ Deleting an instance of a concrete model should also delete objects @@ -244,7 +241,6 @@ def test_delete_concrete_parent(self): self.assertEqual(len(FooFile.objects.all()), 0) self.assertEqual(len(FooImage.objects.all()), 0) - def test_delete_proxy_pair(self): """ If a pair of proxy models are linked by an FK from one concrete parent diff --git a/tests/files/tests.py b/tests/files/tests.py index 7d34fdbb16494..105d8c3ff9f9b 100644 --- a/tests/files/tests.py +++ b/tests/files/tests.py @@ -128,7 +128,6 @@ def test_file_object(self): with temp_storage.open('tests/file_obj') as f: self.assertEqual(f.read(), b'some content') - def test_stringio(self): # Test passing StringIO instance as content argument to save output = StringIO() diff --git a/tests/fixtures_model_package/tests.py b/tests/fixtures_model_package/tests.py index 2fa1fd10ef106..e35f18081787b 100644 --- a/tests/fixtures_model_package/tests.py +++ b/tests/fixtures_model_package/tests.py @@ -41,7 +41,6 @@ def test_migrate(self): ) self.assertQuerysetEqual(Book.objects.all(), []) - def test_flush(self): # Test presence of fixture (flush called by TransactionTestCase) self.assertQuerysetEqual( diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py index 514525934b4d0..eb57a698bed8e 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -372,7 +372,6 @@ def test_dumpdata_uses_default_manager(self): self.maxDiff = 1024 self.assertEqual(data, animals_data) - def test_proxy_model_included(self): """ Regression for #11428 - Proxy models aren't included when you dumpdata diff --git a/tests/forms_tests/tests/test_extra.py b/tests/forms_tests/tests/test_extra.py index f66241c7daac6..8754c2f2e2597 100644 --- a/tests/forms_tests/tests/test_extra.py +++ b/tests/forms_tests/tests/test_extra.py @@ -509,7 +509,6 @@ def compress(self, data_list): self.assertTrue(f._has_changed('some text,JP,2007-04-25 06:24:00', ['some text', ['J','P'], ['2009-04-25','11:44:00']])) - class ComplexFieldForm(Form): field1 = ComplexField(widget=w) diff --git a/tests/forms_tests/tests/test_fields.py b/tests/forms_tests/tests/test_fields.py index 1ac2c62d66784..152e53773e2e0 100644 --- a/tests/forms_tests/tests/test_fields.py +++ b/tests/forms_tests/tests/test_fields.py @@ -69,7 +69,6 @@ def __init__(self): self.class_a_var = True super(A, self).__init__() - class ComplexField(Field, A): def __init__(self): super(ComplexField, self).__init__() @@ -718,7 +717,6 @@ def test_filefield_changed(self): # with here) self.assertTrue(f._has_changed('resume.txt', {'filename': 'resume.txt', 'content': 'My resume'})) - # URLField ################################################################## def test_urlfield_1(self): @@ -965,7 +963,6 @@ def test_nullbooleanfield_1(self): self.assertEqual(None, f.clean('3')) self.assertEqual(None, f.clean('hello')) - def test_nullbooleanfield_2(self): # Make sure that the internal value is preserved if using HiddenInput (#7753) class HiddenNullBooleanForm(Form): @@ -1218,7 +1215,6 @@ def test_filepathfield_folders(self): self.assertEqual(exp[1], got[1]) self.assertTrue(got[0].endswith(exp[0])) - # SplitDateTimeField ########################################################## def test_splitdatetimefield_1(self): diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index e971860909061..5dcde4e017901 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -1810,7 +1810,6 @@ def __init__(self, fields=(), *args, **kwargs): CharField(label='Name', max_length=10)) super(ChoicesField, self).__init__(fields=fields, *args, **kwargs) - field = ChoicesField() field2 = copy.deepcopy(field) self.assertTrue(isinstance(field2, ChoicesField)) diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py index e36d8c2b7755c..28ebfd08cc0f5 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -1068,7 +1068,6 @@ class CheckForm(Form): formset = CheckFormSet(data, prefix='check') self.assertTrue(formset.is_valid()) - def test_formset_total_error_count(self): """A valid formset should have 0 total errors.""" data = [ # formset_data, expected error count @@ -1164,7 +1163,6 @@ def test_with_management_data_attrs_work_fine(self): self.assertTrue(formset.forms[0].is_valid()) self.assertEqual([{}], formset.cleaned_data) - def test_form_errors_are_caught_by_formset(self): data = { 'form-TOTAL_FORMS': '2', diff --git a/tests/generic_relations/tests.py b/tests/generic_relations/tests.py index 6f3f267c5fe51..9ad8acb709ed5 100644 --- a/tests/generic_relations/tests.py +++ b/tests/generic_relations/tests.py @@ -151,7 +151,6 @@ def test_generic_relations(self): "" ]) - def test_multiple_gfk(self): # Simple tests for multiple GenericForeignKeys # only uses one model, since the above tests should be sufficient. diff --git a/tests/generic_views/test_dates.py b/tests/generic_views/test_dates.py index d15f6637fdc0a..3e6f8a2c1f094 100644 --- a/tests/generic_views/test_dates.py +++ b/tests/generic_views/test_dates.py @@ -22,7 +22,6 @@ class ArchiveIndexViewTests(TestCase): fixtures = ['generic-views-test-data.json'] urls = 'generic_views.urls' - def test_archive_view(self): res = self.client.get('/dates/books/') self.assertEqual(res.status_code, 200) diff --git a/tests/generic_views/test_edit.py b/tests/generic_views/test_edit.py index d38f4e0f4564d..87a2e346e4450 100644 --- a/tests/generic_views/test_edit.py +++ b/tests/generic_views/test_edit.py @@ -156,7 +156,6 @@ class MyCreateView(CreateView): ['name', 'slug']) self.assertEqual(len(w), 0) - def test_create_view_without_explicit_fields(self): with warnings.catch_warnings(record=True) as w: diff --git a/tests/http_utils/tests.py b/tests/http_utils/tests.py index 6e26134c688d4..9105e64ee4056 100644 --- a/tests/http_utils/tests.py +++ b/tests/http_utils/tests.py @@ -59,7 +59,6 @@ def test_conditional_content_removal(self): conditional_content_removal(req, res) self.assertEqual(b''.join(res), b'') - # Strip content for HEAD requests. req.method = 'HEAD' diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 6d8910bf04bf9..9d35b9e54c658 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -262,7 +262,6 @@ def test_template_tags_pgettext(self): self.assertRaises(TemplateSyntaxError, Template, '{% load i18n %}{% blocktrans context %}{% endblocktrans %}') self.assertRaises(TemplateSyntaxError, Template, '{% load i18n %}{% blocktrans count number=2 context %}{{ number }} super result{% plural %}{{ number }} super results{% endblocktrans %}') - def test_string_concat(self): """ six.text_type(string_concat(...)) should not raise a TypeError - #4796 diff --git a/tests/m2m_through/tests.py b/tests/m2m_through/tests.py index 69a7ec99bf787..d6bad0d51f8f9 100644 --- a/tests/m2m_through/tests.py +++ b/tests/m2m_through/tests.py @@ -66,8 +66,6 @@ def test_m2m_through(self): [] ) - - def test_forward_descriptors(self): # Due to complications with adding via an intermediary model, # the add method is not provided. diff --git a/tests/middleware/tests.py b/tests/middleware/tests.py index 0897ec06be582..f0119191d78fe 100644 --- a/tests/middleware/tests.py +++ b/tests/middleware/tests.py @@ -130,7 +130,6 @@ def test_prepend_www_append_slash_slashless(self): self.assertEqual(r.url, 'http://www.testserver/middleware/slash/') - # The following tests examine expected behavior given a custom urlconf that # overrides the default one through the request object. diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index f6e9a886a23c0..46f3b95272cda 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -31,7 +31,6 @@ class Meta: model = ImageFile fields = '__all__' - class OptionalImageFileForm(forms.ModelForm): class Meta: model = OptionalImageFile @@ -62,7 +61,6 @@ class Meta: fields = '__all__' - class ExplicitPKForm(forms.ModelForm): class Meta: model = ExplicitPK @@ -609,8 +607,6 @@ def test_notrequired_overrides_notblank(self): assert form.is_valid() - - # unique/unique_together validation class UniqueTest(TestCase): def setUp(self): diff --git a/tests/model_forms_regress/tests.py b/tests/model_forms_regress/tests.py index ffe1123b9946a..c10deef6d0999 100644 --- a/tests/model_forms_regress/tests.py +++ b/tests/model_forms_regress/tests.py @@ -92,7 +92,6 @@ def test_override_clean(self): self.assertEqual(form.instance.left, 1) - class PartiallyLocalizedTripleForm(forms.ModelForm): class Meta: model = Triple diff --git a/tests/multiple_database/tests.py b/tests/multiple_database/tests.py index edc4b99f09c42..58307c8d321b8 100644 --- a/tests/multiple_database/tests.py +++ b/tests/multiple_database/tests.py @@ -66,7 +66,6 @@ def test_default_creation(self): title="Dive into Python" ) - def test_other_creation(self): "Objects created on another database don't leak onto the default database" # Create a book on the second database @@ -201,7 +200,6 @@ def test_m2m_forward_operations(self): self.assertEqual(list(Book.objects.using('other').filter(authors__name='John Smith').values_list('title', flat=True)), []) - dive.authors.add(john) self.assertEqual(list(Book.objects.using('other').filter(authors__name='Mark Pilgrim').values_list('title', flat=True)), ['Dive into Python']) @@ -1027,7 +1025,6 @@ def test_partial_router(self): self.assertFalse(router.allow_migrate('default', User)) self.assertTrue(router.allow_migrate('default', Book)) - def test_database_routing(self): marty = Person.objects.using('default').create(name="Marty Alchin") pro = Book.objects.using('default').create(title="Pro Django", @@ -1907,8 +1904,6 @@ def test_migrate_to_other_database_with_router(self): self.assertEqual(cts.count(), 0) - - class RouterUsed(Exception): WRITE = 'write' diff --git a/tests/nested_foreign_keys/tests.py b/tests/nested_foreign_keys/tests.py index e8e20762fedb9..fbce384ac6b4f 100644 --- a/tests/nested_foreign_keys/tests.py +++ b/tests/nested_foreign_keys/tests.py @@ -29,7 +29,6 @@ def setUp(self): self.director = Person.objects.create(name='Terry Gilliam / Terry Jones') self.movie = Movie.objects.create(title='Monty Python and the Holy Grail', director=self.director) - # This test failed in #16715 because in some cases INNER JOIN was selected # for the second foreign key relation instead of LEFT OUTER JOIN. def testInheritance(self): @@ -52,7 +51,6 @@ def testInheritance(self): self.assertEqual(Event.objects.filter(screening__movie=self.movie).count(), 1) self.assertEqual(Event.objects.exclude(screening__movie=self.movie).count(), 1) - # These all work because the second foreign key in the chain has null=True. def testInheritanceNullFK(self): some_event = Event.objects.create() @@ -100,7 +98,6 @@ def testExplicitForeignKey(self): self.assertEqual(Package.objects.filter(screening__movie=self.movie).count(), 1) self.assertEqual(Package.objects.exclude(screening__movie=self.movie).count(), 1) - # These all work because the second foreign key in the chain has null=True. def testExplicitForeignKeyNullFK(self): package = PackageNullFK.objects.create() @@ -131,7 +128,6 @@ def setUp(self): self.director = Person.objects.create(name='Terry Gilliam / Terry Jones') self.movie = Movie.objects.create(title='Monty Python and the Holy Grail', director=self.director) - def testInheritance(self): some_event = Event.objects.create() screening = Screening.objects.create(movie=self.movie) @@ -151,7 +147,6 @@ def testInheritance(self): self.assertEqual(Event.objects.filter(screening__movie__director=self.director).count(), 1) self.assertEqual(Event.objects.exclude(screening__movie__director=self.director).count(), 1) - def testExplicitForeignKey(self): package = Package.objects.create() screening = Screening.objects.create(movie=self.movie) diff --git a/tests/or_lookups/tests.py b/tests/or_lookups/tests.py index add9b81b3cb71..6cd1b539c7cbb 100644 --- a/tests/or_lookups/tests.py +++ b/tests/or_lookups/tests.py @@ -59,7 +59,6 @@ def test_filter_or(self): attrgetter("headline") ) - def test_stages(self): # You can shorten this syntax with code like the following, which is # especially useful if building the query in stages: diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py index 6f51d8d035363..b3290bfc6994a 100644 --- a/tests/prefetch_related/tests.py +++ b/tests/prefetch_related/tests.py @@ -48,7 +48,6 @@ def test_m2m_forward(self): normal_lists = [list(b.authors.all()) for b in Book.objects.all()] self.assertEqual(lists, normal_lists) - def test_m2m_reverse(self): with self.assertNumQueries(2): lists = [list(a.books.all()) for a in Author.objects.prefetch_related('books')] diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 32ffc06dbb719..1f0ea327abbb4 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -1527,7 +1527,6 @@ def test_ordering(self): ['', '', ''] ) - # Ordering of extra() pieces is possible, too and you can mix extra # fields and model fields in the ordering. self.assertQuerysetEqual( diff --git a/tests/requests/tests.py b/tests/requests/tests.py index 45e219f3450e3..be10623f8710b 100644 --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -611,7 +611,6 @@ def test_http_get_host_with_x_forwarded_host(self): } request.get_host() - @override_settings(DEBUG=True, ALLOWED_HOSTS=[]) def test_host_validation_disabled_in_debug_mode(self): """If ALLOWED_HOSTS is empty and DEBUG is True, all hosts pass.""" diff --git a/tests/select_related_regress/tests.py b/tests/select_related_regress/tests.py index 08ada4515e2d9..7153a9715d046 100644 --- a/tests/select_related_regress/tests.py +++ b/tests/select_related_regress/tests.py @@ -45,7 +45,6 @@ def test_regression_7110(self): # twice each, plus connection once). Thus, 6 joins plus the FROM table. self.assertEqual(str(connections.query).count(" JOIN "), 6) - def test_regression_8106(self): """ Regression test for bug #8106. diff --git a/tests/template_tests/test_response.py b/tests/template_tests/test_response.py index 65f753136185c..fe58a58d6d40b 100644 --- a/tests/template_tests/test_response.py +++ b/tests/template_tests/test_response.py @@ -146,7 +146,6 @@ def post2(obj): self.assertEqual(response.content, b'First template\n') self.assertEqual(post, ['post1','post2']) - def test_pickling(self): # Create a template response. The context is # known to be unpickleable (e.g., a function). diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index 353d99ee83c6c..4139402506c85 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -283,7 +283,6 @@ def test_include_missing_template(self): loader.template_source_loaders = old_loaders settings.TEMPLATE_DEBUG = old_td - def test_extends_include_missing_baseloader(self): """ Tests that the correct template is identified as not existing @@ -1821,9 +1820,9 @@ def get_template_tests(self): 'numpy-array-index02': ("{{ var.5 }}", {"var": numpy.array(["first item", "second item"])}, ("", "INVALID")), }) - return tests + class TemplateTagLoading(unittest.TestCase): def setUp(self): diff --git a/tests/transactions/tests.py b/tests/transactions/tests.py index 0cef7a545bab8..a66ffe44ba227 100644 --- a/tests/transactions/tests.py +++ b/tests/transactions/tests.py @@ -490,7 +490,6 @@ def create_reporter(): r = Reporter.objects.get() self.assertEqual(r.first_name, "Robert") - @skipUnlessDBFeature('supports_transactions') def test_manually_managed(self): """ diff --git a/tests/wsgi/tests.py b/tests/wsgi/tests.py index afd59a6e1ff27..bf8bc2d60bf38 100644 --- a/tests/wsgi/tests.py +++ b/tests/wsgi/tests.py @@ -67,7 +67,6 @@ def test_success(self): self.assertTrue(app is application) - @override_settings(WSGI_APPLICATION=None) def test_default(self): """ @@ -90,7 +89,6 @@ def mock_get_wsgi_app(): finally: basehttp.get_wsgi_application = _orig_get_wsgi_app - @override_settings(WSGI_APPLICATION="wsgi.noexist.app") def test_bad_module(self): with six.assertRaisesRegex(self, @@ -99,7 +97,6 @@ def test_bad_module(self): get_internal_wsgi_application() - @override_settings(WSGI_APPLICATION="wsgi.wsgi.noexist") def test_bad_name(self): with six.assertRaisesRegex(self,