diff options
| author | Alasdair Nicol <alasdair@memset.com> | 2013-10-18 10:02:43 +0100 |
|---|---|---|
| committer | Alasdair Nicol <alasdair@memset.com> | 2013-10-18 10:07:39 +0100 |
| commit | a800036981c6fea8eb3dac22467965c71af05d29 (patch) | |
| tree | c872f8a78d26f1de133d415fef922013dafe878a /tests | |
| parent | 65750b83523870851008e804364121f8c458fc2d (diff) | |
Fixed #21287 -- Fixed E123 pep8 warnings
Diffstat (limited to 'tests')
41 files changed, 84 insertions, 84 deletions
diff --git a/tests/admin_scripts/management/commands/custom_startproject.py b/tests/admin_scripts/management/commands/custom_startproject.py index 80c6d6b805..8144b5b69c 100644 --- a/tests/admin_scripts/management/commands/custom_startproject.py +++ b/tests/admin_scripts/management/commands/custom_startproject.py @@ -8,4 +8,4 @@ class Command(BaseCommand): make_option('--extra', action='store', dest='extra', help='An arbitrary extra value passed to the context'), - ) + ) diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py index adccae6c26..0f16fdb81e 100644 --- a/tests/admin_views/models.py +++ b/tests/admin_views/models.py @@ -171,7 +171,7 @@ class Fabric(models.Model): ('Textured', ( ('x', 'Horizontal'), ('y', 'Vertical'), - ) + ) ), ('plain', 'Smooth'), ) diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 25a4b02495..438522189a 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -431,7 +431,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase): values=[p.name for p in Promo.objects.all()], test=lambda obj, value: obj.chap.book.promo_set.filter(name=value).exists()), - } + } for filter_path, params in filters.items(): for value in params['values']: query_string = urlencode({filter_path: value}) @@ -1256,7 +1256,7 @@ class AdminViewPermissionsTest(TestCase): 'index': 0, 'action': ['delete_selected'], '_selected_action': ['1'], - }) + }) self.assertTemplateUsed(response, 'custom_admin/delete_selected_confirmation.html') response = self.client.get('/test_admin/admin/admin_views/customarticle/%d/history/' % article_pk) self.assertTemplateUsed(response, 'custom_admin/object_history.html') @@ -1474,7 +1474,7 @@ class AdminViewDeletedObjectsTest(TestCase): """<li>Super villain: <a href="/test_admin/admin/admin_views/supervillain/3/">Bob</a>""", """<li>Secret hideout: floating castle""", """<li>Super secret hideout: super floating castle!""" - ] + ] response = self.client.get('/test_admin/admin/admin_views/villain/%s/delete/' % quote(3)) for should in should_contain: self.assertContains(response, should, 1) diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 111ef79b5e..078c1a9d1b 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -256,7 +256,7 @@ class AggregationTests(TestCase): self.assertEqual( Book.objects.annotate(c=Count('authors')).values('c').aggregate(Max('c')), {'c__max': 3} - ) + ) def test_field_error(self): # Bad field requests in aggregates are caught and reported diff --git a/tests/basic/tests.py b/tests/basic/tests.py index 5c1ed0726a..5d5e93b1e4 100644 --- a/tests/basic/tests.py +++ b/tests/basic/tests.py @@ -607,7 +607,7 @@ class ModelTest(TestCase): dicts = Article.objects.filter( pub_date__year=2008).extra( select={'dashed-value': '1'} - ).values('headline', 'dashed-value') + ).values('headline', 'dashed-value') self.assertEqual([sorted(d.items()) for d in dicts], [[('dashed-value', 1), ('headline', 'Article 11')], [('dashed-value', 1), ('headline', 'Article 12')]]) diff --git a/tests/cache/tests.py b/tests/cache/tests.py index b107cdb3fe..89c53da6b8 100644 --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -150,7 +150,7 @@ class DummyCacheTests(unittest.TestCase): 'unicode_ascii': 'Iñtërnâtiônàlizætiøn1', 'Iñtërnâtiônàlizætiøn': 'Iñtërnâtiônàlizætiøn2', 'ascii2': {'x' : 1} - } + } for (key, value) in stuff.items(): self.cache.set(key, value) self.assertEqual(self.cache.get(key), None) @@ -354,7 +354,7 @@ class BaseCacheTests(object): 'unicode_ascii': 'Iñtërnâtiônàlizætiøn1', 'Iñtërnâtiônàlizætiøn': 'Iñtërnâtiônàlizætiøn2', 'ascii2': {'x' : 1} - } + } # Test `set` for (key, value) in stuff.items(): self.cache.set(key, value) diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index 83a9e8b09c..703d512ef6 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -61,7 +61,7 @@ class FileUploadTests(TestCase): 'name': 'Ringo', 'file_field1': file1, 'file_field2': file2, - } + } for key in list(post_data): try: @@ -112,7 +112,7 @@ class FileUploadTests(TestCase): post_data = { 'file_unicode': file1, - } + } response = self.client.post('/file_uploads/unicode_name/', post_data) diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py index eb57a698be..4bfb45ea39 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -390,7 +390,7 @@ class TestFixtures(TestCase): stdout.getvalue(), """[{"pk": %d, "model": "fixtures_regress.widget", "fields": {"name": "grommet"}}]""" % widget.pk - ) + ) def test_loaddata_works_when_fixture_has_forward_refs(self): """ @@ -535,7 +535,7 @@ class NaturalKeyFixtureTests(TestCase): 'loaddata', 'forward_ref_lookup.json', verbosity=0, - ) + ) stdout = StringIO() management.call_command( diff --git a/tests/forms_tests/tests/test_fields.py b/tests/forms_tests/tests/test_fields.py index 152e53773e..e04b060916 100644 --- a/tests/forms_tests/tests/test_fields.py +++ b/tests/forms_tests/tests/test_fields.py @@ -1142,7 +1142,7 @@ class FieldsTests(SimpleTestCase): ('/django/forms/util.py', 'util.py'), ('/django/forms/utils.py', 'utils.py'), ('/django/forms/widgets.py', 'widgets.py') - ] + ] for exp, got in zip(expected, fix_os_paths(f.choices)): self.assertEqual(exp[1], got[1]) self.assertTrue(got[0].endswith(exp[0])) @@ -1163,7 +1163,7 @@ class FieldsTests(SimpleTestCase): ('/django/forms/util.py', 'util.py'), ('/django/forms/utils.py', 'utils.py'), ('/django/forms/widgets.py', 'widgets.py') - ] + ] for exp, got in zip(expected, fix_os_paths(f.choices)): self.assertEqual(exp[1], got[1]) self.assertTrue(got[0].endswith(exp[0])) @@ -1184,7 +1184,7 @@ class FieldsTests(SimpleTestCase): ('/django/forms/util.py', 'util.py'), ('/django/forms/utils.py', 'utils.py'), ('/django/forms/widgets.py', 'widgets.py') - ] + ] for exp, got in zip(expected, fix_os_paths(f.choices)): self.assertEqual(exp[1], got[1]) self.assertTrue(got[0].endswith(exp[0])) diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py index 28ebfd08cc..4b4a4bc001 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -996,9 +996,9 @@ class FormsFormsetTestCase(TestCase): 'choices-2-votes': '2', 'choices-3-choice': 'Three', 'choices-3-votes': '3', - }, + }, prefix='choices', - ) + ) # But we still only instantiate 3 forms self.assertEqual(len(formset.forms), 3) # and the formset isn't valid @@ -1028,9 +1028,9 @@ class FormsFormsetTestCase(TestCase): 'choices-2-votes': '2', 'choices-3-choice': 'Three', 'choices-3-votes': '3', - }, + }, prefix='choices', - ) + ) # Four forms are instantiated and no exception is raised self.assertEqual(len(formset.forms), 4) finally: diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py index 618ab8e07c..159d03ab7e 100644 --- a/tests/forms_tests/tests/tests.py +++ b/tests/forms_tests/tests/tests.py @@ -128,7 +128,7 @@ class ModelFormCallableModelDefault(TestCase): 'choice_int': obj2, 'multi_choice': [obj2,obj3], 'multi_choice_int': ChoiceOptionModel.objects.exclude(name="default"), - }).as_p(), """<p><label for="id_choice">Choice:</label> <select name="choice" id="id_choice"> + }).as_p(), """<p><label for="id_choice">Choice:</label> <select name="choice" id="id_choice"> <option value="1">ChoiceOption 1</option> <option value="2" selected="selected">ChoiceOption 2</option> <option value="3">ChoiceOption 3</option> diff --git a/tests/generic_relations/tests.py b/tests/generic_relations/tests.py index 9ad8acb709..64219e4897 100644 --- a/tests/generic_relations/tests.py +++ b/tests/generic_relations/tests.py @@ -105,7 +105,7 @@ class GenericRelationsTests(TestCase): ('salty', Vegetable, bacon.pk), ('shiny', Animal, platypus.pk), ('yellow', Animal, lion.pk) - ], + ], comp_func ) lion.delete() @@ -115,7 +115,7 @@ class GenericRelationsTests(TestCase): ('fatty', Vegetable, bacon.pk), ('salty', Vegetable, bacon.pk), ('shiny', Animal, platypus.pk) - ], + ], comp_func ) @@ -129,7 +129,7 @@ class GenericRelationsTests(TestCase): ('fatty', Vegetable, bacon.pk), ('salty', Vegetable, bacon.pk), ('shiny', Animal, platypus.pk) - ], + ], comp_func ) # If you delete a tag, the objects using the tag are unaffected @@ -142,7 +142,7 @@ class GenericRelationsTests(TestCase): ('fatty', Animal, platypus.pk), ('salty', Vegetable, bacon.pk), ('shiny', Animal, platypus.pk) - ], + ], comp_func ) TaggedItem.objects.filter(tag='fatty').delete() diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index 9d35b9e54c..8e73c860de 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -787,7 +787,7 @@ class FormattingTests(TransRealMixin, TestCase): 'date_added': datetime.datetime(2009, 12, 31, 6, 0, 0), 'cents_paid': decimal.Decimal('59.47'), 'products_delivered': 12000, - }) + }) context = Context({'form': form}) self.assertTrue(form.is_valid()) diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py index ef9f979e7e..6007a4f376 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -161,7 +161,7 @@ class AdminEmailHandlerTest(TestCase): admin_email_handler = [ h for h in logger.handlers if h.__class__.__name__ == "AdminEmailHandler" - ][0] + ][0] return admin_email_handler def test_fail_silently(self): @@ -171,7 +171,7 @@ class AdminEmailHandlerTest(TestCase): @override_settings( ADMINS=(('whatever admin', 'admin@example.com'),), EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-' - ) + ) def test_accepts_args(self): """ Ensure that user-supplied arguments and the EMAIL_SUBJECT_PREFIX @@ -202,7 +202,7 @@ class AdminEmailHandlerTest(TestCase): ADMINS=(('whatever admin', 'admin@example.com'),), EMAIL_SUBJECT_PREFIX='-SuperAwesomeSubject-', INTERNAL_IPS=('127.0.0.1',), - ) + ) def test_accepts_args_and_request(self): """ Ensure that the subject is also handled if being @@ -237,7 +237,7 @@ class AdminEmailHandlerTest(TestCase): ADMINS=(('admin', 'admin@example.com'),), EMAIL_SUBJECT_PREFIX='', DEBUG=False, - ) + ) def test_subject_accepts_newlines(self): """ Ensure that newlines in email reports' subjects are escaped to avoid @@ -260,7 +260,7 @@ class AdminEmailHandlerTest(TestCase): ADMINS=(('admin', 'admin@example.com'),), EMAIL_SUBJECT_PREFIX='', DEBUG=False, - ) + ) def test_truncate_subject(self): """ RFC 2822's hard limit is 998 characters per line. @@ -281,7 +281,7 @@ class AdminEmailHandlerTest(TestCase): @override_settings( ADMINS=(('admin', 'admin@example.com'),), DEBUG=False, - ) + ) def test_uses_custom_email_backend(self): """ Refs #19325 diff --git a/tests/mail/tests.py b/tests/mail/tests.py index ec99afb5a7..ddd851b61b 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -326,7 +326,7 @@ class MailTests(HeadersCheckMixin, SimpleTestCase): send_mass_mail([ ('Subject1', 'Content1', 'from1@example.com', ['to1@example.com']), ('Subject2', 'Content2', 'from2@example.com', ['to2@example.com']), - ], connection=connection) + ], connection=connection) self.assertEqual(mail.outbox, []) self.assertEqual(len(connection.test_outbox), 2) self.assertEqual(connection.test_outbox[0].subject, 'Subject1') diff --git a/tests/managers_regress/tests.py b/tests/managers_regress/tests.py index 333ffc3b95..e7004b49ed 100644 --- a/tests/managers_regress/tests.py +++ b/tests/managers_regress/tests.py @@ -59,12 +59,12 @@ class ManagersRegressionTests(TestCase): "<Child4: d2>", "<Child4: f1>", "<Child4: f2>" - ] + ] ) self.assertQuerysetEqual(Child4.manager1.all(), [ "<Child4: d1>", "<Child4: f1>" - ], + ], ordered=False ) self.assertQuerysetEqual(Child5._default_manager.all(), ["<Child5: fred>"]) @@ -72,7 +72,7 @@ class ManagersRegressionTests(TestCase): self.assertQuerysetEqual(Child7._default_manager.order_by('name'), [ "<Child7: barney>", "<Child7: fred>" - ] + ] ) def test_abstract_manager(self): diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py index 18f8cd1ba3..dd4aef159f 100644 --- a/tests/middleware_exceptions/tests.py +++ b/tests/middleware_exceptions/tests.py @@ -375,7 +375,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest): self._add_middleware(pre_middleware) self.assert_exceptions_handled('/middleware_exceptions/null_view/', [ "The view middleware_exceptions.views.null_view didn't return an HttpResponse object.", - ], + ], ValueError()) # Check that the right middleware methods have been invoked @@ -392,7 +392,7 @@ class MiddlewareTests(BaseMiddlewareExceptionTest): self._add_middleware(pre_middleware) self.assert_exceptions_handled('/middleware_exceptions/null_view/', [ "The view middleware_exceptions.views.null_view didn't return an HttpResponse object." - ], + ], ValueError()) # Check that the right middleware methods have been invoked @@ -687,7 +687,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest): self.assert_exceptions_handled('/middleware_exceptions/null_view/', [ "The view middleware_exceptions.views.null_view didn't return an HttpResponse object.", 'Test Response Exception' - ]) + ]) # Check that the right middleware methods have been invoked self.assert_middleware_usage(pre_middleware, True, True, False, False, False) @@ -703,7 +703,7 @@ class BadMiddlewareTests(BaseMiddlewareExceptionTest): self._add_middleware(pre_middleware) self.assert_exceptions_handled('/middleware_exceptions/null_view/', [ "The view middleware_exceptions.views.null_view didn't return an HttpResponse object." - ], + ], ValueError()) # Check that the right middleware methods have been invoked diff --git a/tests/model_fields/models.py b/tests/model_fields/models.py index 89ea77b7ae..62d23a587a 100644 --- a/tests/model_fields/models.py +++ b/tests/model_fields/models.py @@ -33,12 +33,12 @@ class Whiz(models.Model): ('Group 1', ( (1, 'First'), (2, 'Second'), - ) + ) ), ('Group 2', ( (3, 'Third'), (4, 'Fourth'), - ) + ) ), (0, 'Other'), ) diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 46f3b95272..9fd220153b 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -466,7 +466,7 @@ class ModelFormBaseTest(TestCase): """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" maxlength="20" /></td></tr> <tr><th><label for="id_slug">Slug:</label></th><td><input id="id_slug" type="text" name="slug" maxlength="20" /></td></tr> <tr><th><label for="id_checkbox">Checkbox:</label></th><td><input type="checkbox" name="checkbox" id="id_checkbox" /></td></tr>""" - ) + ) def test_orderfields_form(self): class OrderFields(forms.ModelForm): @@ -480,7 +480,7 @@ class ModelFormBaseTest(TestCase): str(OrderFields()), """<tr><th><label for="id_url">The URL:</label></th><td><input id="id_url" type="text" name="url" maxlength="40" /></td></tr> <tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" maxlength="20" /></td></tr>""" - ) + ) def test_orderfields2_form(self): class OrderFields2(forms.ModelForm): @@ -831,13 +831,13 @@ class OldFormForXTests(TestCase): """<tr><th><label for="id_name">Name:</label></th><td><input id="id_name" type="text" name="name" maxlength="20" /></td></tr> <tr><th><label for="id_slug">Slug:</label></th><td><input id="id_slug" type="text" name="slug" maxlength="20" /></td></tr> <tr><th><label for="id_url">The URL:</label></th><td><input id="id_url" type="text" name="url" maxlength="40" /></td></tr>""" - ) + ) self.assertHTMLEqual( str(f.as_ul()), """<li><label for="id_name">Name:</label> <input id="id_name" type="text" name="name" maxlength="20" /></li> <li><label for="id_slug">Slug:</label> <input id="id_slug" type="text" name="slug" maxlength="20" /></li> <li><label for="id_url">The URL:</label> <input id="id_url" type="text" name="url" maxlength="40" /></li>""" - ) + ) self.assertHTMLEqual( str(f["name"]), """<input id="id_name" type="text" name="name" maxlength="20" />""") @@ -849,7 +849,7 @@ class OldFormForXTests(TestCase): """<li>Name: <input type="text" name="name" maxlength="20" /></li> <li>Slug: <input type="text" name="slug" maxlength="20" /></li> <li>The URL: <input type="text" name="url" maxlength="40" /></li>""" - ) + ) def test_with_data(self): self.assertEqual(Category.objects.count(), 0) @@ -989,7 +989,7 @@ class OldFormForXTests(TestCase): 'pub_date': '1984-02-06', 'writer': six.text_type(w_royko.pk), 'article': 'Hello.' - }, instance=art) + }, instance=art) self.assertEqual(f.errors, {}) self.assertEqual(f.is_valid(), True) test_art = f.save() @@ -1002,7 +1002,7 @@ class OldFormForXTests(TestCase): 'headline': 'New headline', 'slug': 'new-headline', 'pub_date': '1988-01-04' - }, auto_id=False, instance=art) + }, auto_id=False, instance=art) self.assertHTMLEqual(f.as_ul(), '''<li>Headline: <input type="text" name="headline" value="New headline" maxlength="50" /></li> <li>Slug: <input type="text" name="slug" value="new-headline" maxlength="50" /></li> <li>Pub date: <input type="text" name="pub_date" value="1988-01-04" /></li>''') @@ -1073,7 +1073,7 @@ class OldFormForXTests(TestCase): 'writer': six.text_type(w_royko.pk), 'article': 'Hello.', 'categories': [six.text_type(c1.id), six.text_type(c2.id)] - }, instance=new_art) + }, instance=new_art) new_art = f.save() self.assertEqual(new_art.id == art_id_1, True) new_art = Article.objects.get(id=art_id_1) @@ -1619,7 +1619,7 @@ class OldFormForXTests(TestCase): f = OptionalImageFileForm( data={'description': 'And a final one'}, files={'image': SimpleUploadedFile('test4.png', image_data2)} - ) + ) self.assertEqual(f.is_valid(), True) instance = f.save() self.assertEqual(instance.image.name, 'tests/test4.png') diff --git a/tests/model_formsets_regress/tests.py b/tests/model_formsets_regress/tests.py index 6715b5b10e..a2b3dcdce4 100644 --- a/tests/model_formsets_regress/tests.py +++ b/tests/model_formsets_regress/tests.py @@ -203,7 +203,7 @@ class InlineFormsetTests(TestCase): self.assertQuerysetEqual( dalnet.host_set.order_by("hostname"), ["<Host: matrix.de.eu.dal.net>", "<Host: tranquility.hub.dal.net>"] - ) + ) def test_initial_data(self): user = User.objects.create(username="bibi", serial=1) diff --git a/tests/model_regress/tests.py b/tests/model_regress/tests.py index fdb3b1f87c..8b58ed389e 100644 --- a/tests/model_regress/tests.py +++ b/tests/model_regress/tests.py @@ -123,13 +123,13 @@ class ModelTests(TestCase): self.assertQuerysetEqual( Party.objects.filter(when__year=1), [ datetime.date(1, 3, 3), - ], + ], attrgetter("when") ) self.assertQuerysetEqual( Party.objects.filter(when__year='1'), [ datetime.date(1, 3, 3), - ], + ], attrgetter("when") ) diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py index 46ea428d17..d4ef272117 100644 --- a/tests/pagination/tests.py +++ b/tests/pagination/tests.py @@ -253,7 +253,7 @@ class ModelPaginationTests(TestCase): "<Article: Article 3>", "<Article: Article 4>", "<Article: Article 5>" - ], + ], ordered=False ) self.assertTrue(p.has_next()) @@ -273,7 +273,7 @@ class ModelPaginationTests(TestCase): "<Article: Article 7>", "<Article: Article 8>", "<Article: Article 9>" - ], + ], ordered=False ) self.assertFalse(p.has_next()) @@ -304,7 +304,7 @@ class ModelPaginationTests(TestCase): self.assertQuerysetEqual(p[slice(2)], [ "<Article: Article 1>", "<Article: Article 2>", - ] + ] ) # After __getitem__ is called, object_list is a list self.assertIsInstance(p.object_list, list) diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py index b3290bfc69..db2fddeffe 100644 --- a/tests/prefetch_related/tests.py +++ b/tests/prefetch_related/tests.py @@ -637,7 +637,7 @@ class Ticket19607Tests(TestCase): for id, name1, name2 in [ (1, 'einfach', 'simple'), (2, 'schwierig', 'difficult'), - ]: + ]: LessonEntry.objects.create(id=id, name1=name1, name2=name2) for id, lesson_entry_id, name in [ @@ -645,7 +645,7 @@ class Ticket19607Tests(TestCase): (2, 1, 'simple'), (3, 2, 'schwierig'), (4, 2, 'difficult'), - ]: + ]: WordEntry.objects.create(id=id, lesson_entry_id=lesson_entry_id, name=name) def test_bug(self): diff --git a/tests/requests/tests.py b/tests/requests/tests.py index be10623f87..4dc00aec0a 100644 --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -480,7 +480,7 @@ class HostValidationTests(SimpleTestCase): 'forward.com', 'example.com', 'internal.com', '12.34.56.78', '[2001:19f0:feee::dead:beef:cafe]', 'xn--4ca9at.com', '.multitenant.com', 'INSENSITIVE.com', - ]) + ]) def test_http_get_host(self): # Check if X_FORWARDED_HOST is provided. request = HttpRequest() diff --git a/tests/runtests.py b/tests/runtests.py index da6c1c4fdf..a1c2601aa8 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -168,7 +168,7 @@ def setup(verbosity, test_labels): match = lambda label: ( module_label == label or # exact match module_label.startswith(label + '.') # ancestor match - ) + ) module_found_in_labels = any(match(l) for l in test_labels_set) diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py index 24c9079040..7e06cc809a 100644 --- a/tests/select_for_update/tests.py +++ b/tests/select_for_update/tests.py @@ -68,7 +68,7 @@ class SelectForUpdateTests(TransactionTestCase): sql = 'SELECT * FROM %(db_table)s %(for_update)s;' % { 'db_table': Person._meta.db_table, 'for_update': self.new_connection.ops.for_update_sql(), - } + } self.cursor.execute(sql, ()) self.cursor.fetchone() diff --git a/tests/serializers_regress/tests.py b/tests/serializers_regress/tests.py index a35d7851e0..9094e3d2ce 100644 --- a/tests/serializers_regress/tests.py +++ b/tests/serializers_regress/tests.py @@ -559,7 +559,7 @@ def naturalKeyTest(format, self): for format in [ f for f in serializers.get_serializer_formats() if not isinstance(serializers.get_serializer(f), serializers.BadSerializer) - ]: +]: setattr(SerializerTests, 'test_' + format + '_serializer', curry(serializerTest, format)) setattr(SerializerTests, 'test_' + format + '_natural_key_serializer', curry(naturalKeySerializerTest, format)) setattr(SerializerTests, 'test_' + format + '_serializer_fields', curry(fieldsTest, format)) diff --git a/tests/signing/tests.py b/tests/signing/tests.py index 5c5c2b1da7..8b470b9a38 100644 --- a/tests/signing/tests.py +++ b/tests/signing/tests.py @@ -33,7 +33,7 @@ class TestSigner(TestCase): signer.signature('hello'), signing.base64_hmac('extra-salt' + 'signer', 'hello', 'predictable-secret').decode() - ) + ) self.assertNotEqual( signing.Signer('predictable-secret', salt='one').signature('hello'), signing.Signer('predictable-secret', salt='two').signature('hello')) diff --git a/tests/template_tests/templatetags/custom.py b/tests/template_tests/templatetags/custom.py index 5e96ca8eb7..cdcabd8ffe 100644 --- a/tests/template_tests/templatetags/custom.py +++ b/tests/template_tests/templatetags/custom.py @@ -81,7 +81,7 @@ def simple_unlimited_args_kwargs(one, two='hi', *args, **kwargs): return "simple_unlimited_args_kwargs - Expected result: %s / %s" % ( ', '.join(six.text_type(arg) for arg in [one, two] + list(args)), ', '.join('%s=%s' % (k, v) for (k, v) in sorted_kwarg) - ) + ) simple_unlimited_args_kwargs.anything = "Expected simple_unlimited_args_kwargs __dict__" @register.simple_tag(takes_context=True) @@ -232,7 +232,7 @@ def inclusion_unlimited_args_kwargs(one, two='hi', *args, **kwargs): return {"result": "inclusion_unlimited_args_kwargs - Expected result: %s / %s" % ( ', '.join(six.text_type(arg) for arg in [one, two] + list(args)), ', '.join('%s=%s' % (k, v) for (k, v) in sorted_kwarg) - )} + )} inclusion_unlimited_args_kwargs.anything = "Expected inclusion_unlimited_args_kwargs __dict__" @register.inclusion_tag('inclusion.html', takes_context=True) @@ -303,7 +303,7 @@ def assignment_unlimited_args_kwargs(one, two='hi', *args, **kwargs): return "assignment_unlimited_args_kwargs - Expected result: %s / %s" % ( ', '.join(six.text_type(arg) for arg in [one, two] + list(args)), ', '.join('%s=%s' % (k, v) for (k, v) in sorted_kwarg) - ) + ) assignment_unlimited_args_kwargs.anything = "Expected assignment_unlimited_args_kwargs __dict__" @register.assignment_tag(takes_context=True) diff --git a/tests/template_tests/test_loaders.py b/tests/template_tests/test_loaders.py index 41aa3b5826..8acfe93a19 100644 --- a/tests/template_tests/test_loaders.py +++ b/tests/template_tests/test_loaders.py @@ -112,7 +112,7 @@ class CachedLoader(unittest.TestCase): settings.TEMPLATE_LOADERS = ( ('django.template.loaders.cached.Loader', ( 'django.template.loaders.filesystem.Loader', - ) + ) ), ) def tearDown(self): diff --git a/tests/template_tests/test_parser.py b/tests/template_tests/test_parser.py index 8deb11da89..b9468fa303 100644 --- a/tests/template_tests/test_parser.py +++ b/tests/template_tests/test_parser.py @@ -123,7 +123,7 @@ class ParserTests(TestCase): '1|two_arguments', '1|two_arguments:"1"', '1|two_one_opt_arg', - ): + ): with self.assertRaises(TemplateSyntaxError): FilterExpression(expr, p) for expr in ( @@ -135,5 +135,5 @@ class ParserTests(TestCase): '1|one_opt_argument:"1"', # Not supplying all '1|two_one_opt_arg:"1"', - ): + ): FilterExpression(expr, p) diff --git a/tests/template_tests/test_response.py b/tests/template_tests/test_response.py index fe58a58d6d..b4dceb195d 100644 --- a/tests/template_tests/test_response.py +++ b/tests/template_tests/test_response.py @@ -152,7 +152,7 @@ class SimpleTemplateResponseTest(TestCase): response = SimpleTemplateResponse('first/test.html', { 'value': 123, 'fn': datetime.now, - }) + }) self.assertRaises(ContentNotRenderedError, pickle.dumps, response) @@ -180,7 +180,7 @@ class SimpleTemplateResponseTest(TestCase): response = SimpleTemplateResponse('first/test.html', { 'value': 123, 'fn': datetime.now, - }) + }) self.assertRaises(ContentNotRenderedError, pickle.dumps, response) @@ -193,7 +193,7 @@ class SimpleTemplateResponseTest(TestCase): response = SimpleTemplateResponse('first/test.html', { 'value': 123, 'fn': datetime.now, - }) + }) response.cookies['key'] = 'value' @@ -286,7 +286,7 @@ class TemplateResponseTest(TestCase): response = SimpleTemplateResponse('first/test.html', { 'value': 123, 'fn': datetime.now, - }) + }) self.assertRaises(ContentNotRenderedError, pickle.dumps, response) diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index 4139402506..ef3b4588a6 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -573,7 +573,7 @@ class TemplateTests(TransRealMixin, TestCase): ('', False, normal_string_result), (expected_invalid_str, False, invalid_string_result), ('', True, template_debug_result) - ]: + ]: settings.TEMPLATE_STRING_IF_INVALID = invalid_str settings.TEMPLATE_DEBUG = template_debug for is_cached in (False, True): diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index 00b5e9c978..50655218f4 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -355,7 +355,7 @@ class DeprecationDisplayTest(AdminScriptTestCase): def setUp(self): settings = { 'DATABASES': '{"default": {"ENGINE":"django.db.backends.sqlite3", "NAME":":memory:"}}' - } + } self.write_settings('settings.py', sdict=settings) def tearDown(self): diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py index 28e9e326e0..ddfc67c1f1 100644 --- a/tests/utils_tests/test_html.py +++ b/tests/utils_tests/test_html.py @@ -49,7 +49,7 @@ class TestUtilsHtml(TestCase): fourth=html.mark_safe("<i>safe again</i>") ), "< Dangerous > <b>safe</b> < dangerous again <i>safe again</i>" - ) + ) def test_linebreaks(self): f = html.linebreaks diff --git a/tests/utils_tests/test_jslex.py b/tests/utils_tests/test_jslex.py index a2af7b4bcf..084e2feb5b 100644 --- a/tests/utils_tests/test_jslex.py +++ b/tests/utils_tests/test_jslex.py @@ -103,7 +103,7 @@ class JsTokensTest(TestCase): "id value", "punct .", "id replace", "punct (", r"regex /\\/g", "punct ,", r'string "\\\\"', "punct )", "punct .", "id replace", "punct (", r'regex /"/g', "punct ,", r'string "\\\""', "punct )", "punct +", r'string "\")"', "punct ;"]), - ] + ] def make_function(input, toks): def test_func(self): diff --git a/tests/validation/test_unique.py b/tests/validation/test_unique.py index 79b197a262..e0c5e3fd3a 100644 --- a/tests/validation/test_unique.py +++ b/tests/validation/test_unique.py @@ -43,7 +43,7 @@ class GetUniqueCheckTests(unittest.TestCase): [(UniqueForDateModel, 'date', 'count', 'start_date'), (UniqueForDateModel, 'year', 'count', 'end_date'), (UniqueForDateModel, 'month', 'order', 'end_date')] - ), m._get_unique_checks() + ), m._get_unique_checks() ) def test_unique_for_date_exclusion(self): @@ -52,7 +52,7 @@ class GetUniqueCheckTests(unittest.TestCase): [(UniqueForDateModel, ('id',))], [(UniqueForDateModel, 'year', 'count', 'end_date'), (UniqueForDateModel, 'month', 'order', 'end_date')] - ), m._get_unique_checks(exclude='start_date') + ), m._get_unique_checks(exclude='start_date') ) class PerformUniqueChecksTest(TestCase): diff --git a/tests/view_tests/tests/test_static.py b/tests/view_tests/tests/test_static.py index 8f67890c11..a31f2d7d5a 100644 --- a/tests/view_tests/tests/test_static.py +++ b/tests/view_tests/tests/test_static.py @@ -59,7 +59,7 @@ class StaticTests(SimpleTestCase): HTTP_IF_MODIFIED_SINCE='Mon, 18 Jan 2038 05:14:07 GMT' # This is 24h before max Unix time. Remember to fix Django and # update this test well before 2038 :) - ) + ) self.assertIsInstance(response, HttpResponseNotModified) def test_invalid_if_modified_since(self): diff --git a/tests/view_tests/views.py b/tests/view_tests/views.py index 6e8fa7f813..139862e2c0 100644 --- a/tests/view_tests/views.py +++ b/tests/view_tests/views.py @@ -154,7 +154,7 @@ def send_log(request, exc_info): admin_email_handler = [ h for h in logger.handlers if h.__class__.__name__ == "AdminEmailHandler" - ][0] + ][0] orig_filters = admin_email_handler.filters admin_email_handler.filters = [] admin_email_handler.include_html = True diff --git a/tests/wsgi/tests.py b/tests/wsgi/tests.py index bf8bc2d60b..c93094d24c 100644 --- a/tests/wsgi/tests.py +++ b/tests/wsgi/tests.py @@ -34,7 +34,7 @@ class WSGITest(TestCase): PATH_INFO="/", CONTENT_TYPE="text/html; charset=utf-8", REQUEST_METHOD="GET" - ) + ) response_data = {} diff --git a/tests/wsgi/urls.py b/tests/wsgi/urls.py index 9639f0fd34..7c6701adec 100644 --- a/tests/wsgi/urls.py +++ b/tests/wsgi/urls.py @@ -7,4 +7,4 @@ def helloworld(request): urlpatterns = patterns( "", url("^$", helloworld) - ) +) |
