summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-03 11:20:46 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-03 11:38:46 +0100
commitd55a1e5809b424907528af42bfdfc2991ef11651 (patch)
tree605247aa8b905c148d6e5f480da3f0d2a2eec586 /tests
parent76c80d96f3828a5a3f66842932a5624674ba99a2 (diff)
[4.0.x] Refs #33476 -- Refactored problematic code before reformatting by Black.
In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], ) Backport of c5cd8783825b5f6384417dac5f3889b4210b7d08 from main.
Diffstat (limited to 'tests')
-rw-r--r--tests/annotations/tests.py8
-rw-r--r--tests/cache/tests.py3
-rw-r--r--tests/expressions/tests.py14
-rw-r--r--tests/file_uploads/tests.py3
-rw-r--r--tests/forms_tests/widget_tests/test_multiwidget.py3
-rw-r--r--tests/gis_tests/geoapp/test_functions.py3
-rw-r--r--tests/invalid_models_tests/test_models.py18
-rw-r--r--tests/migrations/test_commands.py29
-rw-r--r--tests/migrations/test_writer.py3
-rw-r--r--tests/model_fields/test_jsonfield.py3
-rw-r--r--tests/modeladmin/test_checks.py3
-rw-r--r--tests/postgres_tests/test_operations.py3
-rw-r--r--tests/prefetch_related/tests.py29
-rw-r--r--tests/queries/tests.py3
-rw-r--r--tests/requests/test_data_upload_settings.py3
-rw-r--r--tests/requests/tests.py10
-rwxr-xr-xtests/runtests.py3
-rw-r--r--tests/shell/tests.py5
-rw-r--r--tests/template_tests/filter_tests/test_urlizetrunc.py7
-rw-r--r--tests/template_tests/syntax_tests/i18n/test_get_language_info.py2
-rw-r--r--tests/template_tests/test_custom.py3
-rw-r--r--tests/test_runner/test_discover_runner.py3
-rw-r--r--tests/test_utils/tests.py3
-rw-r--r--tests/validators/tests.py3
-rw-r--r--tests/view_tests/tests/test_debug.py12
25 files changed, 71 insertions, 108 deletions
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index 62912ee99c..37ca569389 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -967,8 +967,7 @@ class AliasTests(TestCase):
def test_aggregate_alias(self):
msg = (
- "Cannot aggregate over the 'other_age' alias. Use annotate() to "
- "promote it."
+ "Cannot aggregate over the 'other_age' alias. Use annotate() to promote it."
)
with self.assertRaisesMessage(FieldError, msg):
Author.objects.alias(
@@ -992,10 +991,7 @@ class AliasTests(TestCase):
def test_values_alias(self):
qs = Book.objects.alias(rating_alias=F('rating') - 1)
- msg = (
- "Cannot select the 'rating_alias' alias. Use annotate() to "
- "promote it."
- )
+ msg = "Cannot select the 'rating_alias' alias. Use annotate() to promote it."
for operation in ['values', 'values_list']:
with self.subTest(operation=operation):
with self.assertRaisesMessage(FieldError, msg):
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 70cdefbf39..3d0b44707f 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -72,8 +72,7 @@ def empty_response(request):
KEY_ERRORS_WITH_MEMCACHED_MSG = (
- 'Cache key contains characters that will cause errors if used with '
- 'memcached: %r'
+ 'Cache key contains characters that will cause errors if used with memcached: %r'
)
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 33c5189390..1121cec775 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -409,16 +409,22 @@ class BasicExpressionsTests(TestCase):
def test_order_by_multiline_sql(self):
raw_order_by = (
- RawSQL('''
+ RawSQL(
+ """
CASE WHEN num_employees > 1000
THEN num_chairs
ELSE 0 END
- ''', []).desc(),
- RawSQL('''
+ """,
+ [],
+ ).desc(),
+ RawSQL(
+ """
CASE WHEN num_chairs > 1
THEN 1
ELSE 0 END
- ''', []).asc()
+ """,
+ [],
+ ).asc()
)
for qs in (
Company.objects.all(),
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py
index 21cc6c2ac8..8c84fa786b 100644
--- a/tests/file_uploads/tests.py
+++ b/tests/file_uploads/tests.py
@@ -626,8 +626,7 @@ class FileUploadTests(TestCase):
'Content-Disposition: form-data; name="file_field"; filename="MiXeD_cAsE.txt"',
'Content-Type: application/octet-stream',
'',
- 'file contents\n'
- '',
+ 'file contents\n',
'--%(boundary)s--\r\n',
]
response = self.client.post(
diff --git a/tests/forms_tests/widget_tests/test_multiwidget.py b/tests/forms_tests/widget_tests/test_multiwidget.py
index 0e5ee8f73f..cb1e9d31c5 100644
--- a/tests/forms_tests/widget_tests/test_multiwidget.py
+++ b/tests/forms_tests/widget_tests/test_multiwidget.py
@@ -212,8 +212,7 @@ class MultiWidgetTest(WidgetTest):
def test_no_whitespace_between_widgets(self):
widget = MyMultiWidget(widgets=(TextInput, TextInput()))
self.check_html(widget, 'code', None, html=(
- '<input type="text" name="code_0">'
- '<input type="text" name="code_1">'
+ '<input type="text" name="code_0"><input type="text" name="code_1">'
), strict=True)
def test_deepcopy(self):
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py
index a1b1f48e02..67e4313f3f 100644
--- a/tests/gis_tests/geoapp/test_functions.py
+++ b/tests/gis_tests/geoapp/test_functions.py
@@ -370,8 +370,7 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
@skipUnlessDBFeature('has_MakeValid_function')
def test_make_valid_multipolygon(self):
invalid_geom = fromstr(
- 'POLYGON((0 0, 0 1 , 1 1 , 1 0, 0 0), '
- '(10 0, 10 1, 11 1, 11 0, 10 0))'
+ 'POLYGON((0 0, 0 1 , 1 1 , 1 0, 0 0), (10 0, 10 1, 11 1, 11 0, 10 0))'
)
State.objects.create(name='invalid', poly=invalid_geom)
invalid = State.objects.filter(name='invalid').annotate(
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
index 4a36ac8285..c8c4cfa420 100644
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -1707,8 +1707,7 @@ class ConstraintsTests(TestCase):
self.assertEqual(Model.check(databases=self.databases), [
Error(
- "'constraints' refers to the nonexistent field "
- "'missing_field'.",
+ "'constraints' refers to the nonexistent field 'missing_field'.",
obj=Model,
id='models.E012',
),
@@ -1972,8 +1971,7 @@ class ConstraintsTests(TestCase):
self.assertEqual(Model.check(databases=self.databases), [
Error(
- "'constraints' refers to the nonexistent field "
- "'missing_field'.",
+ "'constraints' refers to the nonexistent field 'missing_field'.",
obj=Model,
id='models.E012',
),
@@ -2075,8 +2073,7 @@ class ConstraintsTests(TestCase):
self.assertEqual(Model.check(databases=self.databases), [
Error(
- "'constraints' refers to the nonexistent field "
- "'missing_field'.",
+ "'constraints' refers to the nonexistent field 'missing_field'.",
obj=Model,
id='models.E012',
),
@@ -2193,8 +2190,7 @@ class ConstraintsTests(TestCase):
self.assertEqual(Model.check(databases=self.databases), [
Error(
- "'constraints' refers to the nonexistent field "
- "'missing_field'.",
+ "'constraints' refers to the nonexistent field 'missing_field'.",
obj=Model,
id='models.E012',
),
@@ -2331,8 +2327,7 @@ class ConstraintsTests(TestCase):
self.assertEqual(Model.check(databases=self.databases), [
Error(
- "'constraints' refers to the nonexistent field "
- "'missing_field'.",
+ "'constraints' refers to the nonexistent field 'missing_field'.",
obj=Model,
id='models.E012',
),
@@ -2348,8 +2343,7 @@ class ConstraintsTests(TestCase):
self.assertEqual(Model.check(databases=self.databases), [
Error(
- "'constraints' refers to the nonexistent field "
- "'missing_field'.",
+ "'constraints' refers to the nonexistent field 'missing_field'.",
obj=Model,
id='models.E012',
),
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
index d545f125dd..a376aaf027 100644
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -306,9 +306,7 @@ class MigrateTests(MigrationTestBase):
with mock.patch('django.core.management.color.supports_color', lambda *args: True):
call_command("showmigrations", format='list', stdout=out, verbosity=0, no_color=False)
self.assertEqual(
- '\x1b[1mmigrations\n\x1b[0m'
- ' [ ] 0001_initial\n'
- ' [ ] 0002_second\n',
+ '\x1b[1mmigrations\n\x1b[0m [ ] 0001_initial\n [ ] 0002_second\n',
out.getvalue().lower()
)
@@ -318,9 +316,7 @@ class MigrateTests(MigrationTestBase):
# Giving the explicit app_label tests for selective `show_list` in the command
call_command("showmigrations", "migrations", format='list', stdout=out, verbosity=0, no_color=True)
self.assertEqual(
- 'migrations\n'
- ' [x] 0001_initial\n'
- ' [ ] 0002_second\n',
+ 'migrations\n [x] 0001_initial\n [ ] 0002_second\n',
out.getvalue().lower()
)
out = io.StringIO()
@@ -341,8 +337,7 @@ class MigrateTests(MigrationTestBase):
out = io.StringIO()
call_command('showmigrations', format='list', stdout=out, verbosity=2, no_color=True)
self.assertEqual(
- 'migrations\n'
- ' [ ] 0001_squashed_0002 (2 squashed migrations)\n',
+ 'migrations\n [ ] 0001_squashed_0002 (2 squashed migrations)\n',
out.getvalue().lower(),
)
out = io.StringIO()
@@ -366,8 +361,7 @@ class MigrateTests(MigrationTestBase):
out = io.StringIO()
call_command('showmigrations', format='list', stdout=out, verbosity=2, no_color=True)
self.assertEqual(
- 'migrations\n'
- ' [x] 0001_squashed_0002 (2 squashed migrations)\n',
+ 'migrations\n [x] 0001_squashed_0002 (2 squashed migrations)\n',
out.getvalue().lower(),
)
finally:
@@ -445,8 +439,7 @@ class MigrateTests(MigrationTestBase):
# Show the plan for when there is nothing to apply.
call_command('migrate', 'migrations', '0003', plan=True, stdout=out, no_color=True)
self.assertEqual(
- 'Planned operations:\n'
- ' No planned migration operations.\n',
+ 'Planned operations:\n No planned migration operations.\n',
out.getvalue()
)
out = io.StringIO()
@@ -607,8 +600,7 @@ class MigrateTests(MigrationTestBase):
out = io.StringIO()
call_command('showmigrations', 'mutate_state_b', format='plan', stdout=out)
self.assertEqual(
- '[ ] mutate_state_b.0001_initial\n'
- '[ ] mutate_state_b.0002_add_field\n',
+ '[ ] mutate_state_b.0001_initial\n[ ] mutate_state_b.0002_add_field\n',
out.getvalue()
)
# Single app with dependencies.
@@ -909,8 +901,7 @@ class MigrateTests(MigrationTestBase):
call_command("migrate", "migrations", verbosity=0)
call_command("showmigrations", "migrations", stdout=out, no_color=True)
self.assertEqual(
- 'migrations\n'
- ' [x] 0001_squashed_0002 (2 squashed migrations)\n',
+ 'migrations\n [x] 0001_squashed_0002 (2 squashed migrations)\n',
out.getvalue().lower()
)
applied_migrations = recorder.applied_migrations()
@@ -942,8 +933,7 @@ class MigrateTests(MigrationTestBase):
call_command("migrate", "migrations", verbosity=0)
call_command("showmigrations", "migrations", stdout=out, no_color=True)
self.assertEqual(
- 'migrations\n'
- ' [x] 0001_squashed_0002 (2 squashed migrations)\n',
+ 'migrations\n [x] 0001_squashed_0002 (2 squashed migrations)\n',
out.getvalue().lower()
)
self.assertIn(
@@ -1991,8 +1981,7 @@ class AppLabelErrorTests(TestCase):
"""
nonexistent_app_error = "No installed app with label 'nonexistent_app'."
did_you_mean_auth_error = (
- "No installed app with label 'django.contrib.auth'. Did you mean "
- "'auth'?"
+ "No installed app with label 'django.contrib.auth'. Did you mean 'auth'?"
)
def test_makemigrations_nonexistent_app_label(self):
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
index f21c560208..2c1187bde7 100644
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -86,8 +86,7 @@ class OperationWriterTests(SimpleTestCase):
self.assertEqual(imports, {'import custom_migration_operations.operations'})
self.assertEqual(
buff,
- 'custom_migration_operations.operations.TestOperation(\n'
- '),'
+ 'custom_migration_operations.operations.TestOperation(\n),',
)
def test_args_signature(self):
diff --git a/tests/model_fields/test_jsonfield.py b/tests/model_fields/test_jsonfield.py
index f7721aa6e8..faedd451cb 100644
--- a/tests/model_fields/test_jsonfield.py
+++ b/tests/model_fields/test_jsonfield.py
@@ -129,8 +129,7 @@ class TestFormField(SimpleTestCase):
class TestSerialization(SimpleTestCase):
test_data = (
- '[{"fields": {"value": %s}, '
- '"model": "model_fields.jsonmodel", "pk": null}]'
+ '[{"fields": {"value": %s}, "model": "model_fields.jsonmodel", "pk": null}]'
)
test_values = (
# (Python value, serialized value),
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py
index 1d6f1ba023..b08d52e6dd 100644
--- a/tests/modeladmin/test_checks.py
+++ b/tests/modeladmin/test_checks.py
@@ -411,8 +411,7 @@ class PrepopulatedFieldsCheckTests(CheckTestCase):
self.assertIsInvalid(
TestModelAdmin, ValidationTestModel,
- 'The value of \'prepopulated_fields["slug"]\' must be a list '
- 'or tuple.',
+ 'The value of \'prepopulated_fields["slug"]\' must be a list or tuple.',
'admin.E029'
)
diff --git a/tests/postgres_tests/test_operations.py b/tests/postgres_tests/test_operations.py
index 1464f3177e..790fef8332 100644
--- a/tests/postgres_tests/test_operations.py
+++ b/tests/postgres_tests/test_operations.py
@@ -53,8 +53,7 @@ class AddIndexConcurrentlyTests(OperationTestBase):
operation = AddIndexConcurrently('Pony', index)
self.assertEqual(
operation.describe(),
- 'Concurrently create index pony_pink_idx on field(s) pink of '
- 'model Pony'
+ 'Concurrently create index pony_pink_idx on field(s) pink of model Pony',
)
operation.state_forwards(self.app_label, new_state)
self.assertEqual(len(new_state.models[self.app_label, 'pony'].options['indexes']), 1)
diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py
index 242ff6c366..f8658d33af 100644
--- a/tests/prefetch_related/tests.py
+++ b/tests/prefetch_related/tests.py
@@ -1311,9 +1311,10 @@ class MultiDbTests(TestCase):
books = "".join("%s (%s)\n" %
(b.title, ", ".join(a.name for a in b.first_time_authors.all()))
for b in B.prefetch_related('first_time_authors'))
- self.assertEqual(books,
- "Poems (Charlotte Bronte)\n"
- "Sense and Sensibility (Jane Austen)\n")
+ self.assertEqual(
+ books,
+ "Poems (Charlotte Bronte)\nSense and Sensibility (Jane Austen)\n",
+ )
def test_using_is_honored_inheritance(self):
B = BookWithYear.objects.using('other')
@@ -1350,19 +1351,20 @@ class MultiDbTests(TestCase):
books = "".join("%s (%s)\n" %
(b.title, ", ".join(a.name for a in b.first_time_authors.all()))
for b in B.prefetch_related(prefetch))
- self.assertEqual(books,
- "Poems (Charlotte Bronte)\n"
- "Sense and Sensibility (Jane Austen)\n")
-
+ self.assertEqual(
+ books,
+ "Poems (Charlotte Bronte)\nSense and Sensibility (Jane Austen)\n",
+ )
# Explicit using on the same db.
with self.assertNumQueries(2, using='other'):
prefetch = Prefetch('first_time_authors', queryset=Author.objects.using('other'))
books = "".join("%s (%s)\n" %
(b.title, ", ".join(a.name for a in b.first_time_authors.all()))
for b in B.prefetch_related(prefetch))
- self.assertEqual(books,
- "Poems (Charlotte Bronte)\n"
- "Sense and Sensibility (Jane Austen)\n")
+ self.assertEqual(
+ books,
+ "Poems (Charlotte Bronte)\nSense and Sensibility (Jane Austen)\n",
+ )
# Explicit using on a different db.
with self.assertNumQueries(1, using='default'), self.assertNumQueries(1, using='other'):
@@ -1370,9 +1372,10 @@ class MultiDbTests(TestCase):
books = "".join("%s (%s)\n" %
(b.title, ", ".join(a.name for a in b.first_time_authors.all()))
for b in B.prefetch_related(prefetch))
- self.assertEqual(books,
- "Poems ()\n"
- "Sense and Sensibility ()\n")
+ self.assertEqual(
+ books,
+ "Poems ()\nSense and Sensibility ()\n",
+ )
class Ticket19607Tests(TestCase):
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 9c1b41a395..0e9eefcab6 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -3121,8 +3121,7 @@ class QuerySetExceptionTests(SimpleTestCase):
def test_invalid_order_by(self):
msg = (
- "Cannot resolve keyword '*' into field. Choices are: created, id, "
- "name"
+ "Cannot resolve keyword '*' into field. Choices are: created, id, name"
)
with self.assertRaisesMessage(FieldError, msg):
Article.objects.order_by('*')
diff --git a/tests/requests/test_data_upload_settings.py b/tests/requests/test_data_upload_settings.py
index 44897cc9fa..6f44dbd10d 100644
--- a/tests/requests/test_data_upload_settings.py
+++ b/tests/requests/test_data_upload_settings.py
@@ -41,7 +41,6 @@ class DataUploadMaxMemorySizeMultipartPostTests(SimpleTestCase):
'',
'value',
'--boundary--'
- ''
]))
self.request = WSGIRequest({
'REQUEST_METHOD': 'POST',
@@ -70,7 +69,6 @@ class DataUploadMaxMemorySizeMultipartPostTests(SimpleTestCase):
'',
'value',
'--boundary--'
- ''
]))
request = WSGIRequest({
'REQUEST_METHOD': 'POST',
@@ -143,7 +141,6 @@ class DataUploadMaxNumberOfFieldsMultipartPost(SimpleTestCase):
'',
'value2',
'--boundary--'
- ''
]))
self.request = WSGIRequest({
'REQUEST_METHOD': 'POST',
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 3d8bb45b00..2d76bed7ed 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -316,7 +316,7 @@ class RequestsTests(SimpleTestCase):
'',
'value',
'--boundary--'
- '']))
+ ]))
request = WSGIRequest({
'REQUEST_METHOD': 'POST',
'CONTENT_TYPE': 'multipart/form-data; boundary=boundary',
@@ -341,7 +341,7 @@ class RequestsTests(SimpleTestCase):
b'',
b'value',
b'--boundary--'
- b''])
+ ])
payload = FakePayload(payload_data)
request = WSGIRequest({
'REQUEST_METHOD': 'POST',
@@ -366,7 +366,7 @@ class RequestsTests(SimpleTestCase):
'',
'value',
'--boundary--'
- '']))
+ ]))
request = WSGIRequest({
'REQUEST_METHOD': 'POST',
'CONTENT_TYPE': 'multipart/form-data; boundary=boundary',
@@ -445,8 +445,8 @@ class RequestsTests(SimpleTestCase):
'Content-Disposition: form-data; name="name"',
'',
'value',
- '--boundary--'
- '']))
+ '--boundary--',
+ ]))
request = WSGIRequest({
'REQUEST_METHOD': 'POST',
'CONTENT_TYPE': 'multipart/form-data; boundary=boundary',
diff --git a/tests/runtests.py b/tests/runtests.py
index f922bcd44d..b8e600e719 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -300,8 +300,7 @@ def setup_run_tests(verbosity, start_at, start_after, test_labels=None):
# Force declaring available_apps in TransactionTestCase for faster tests.
def no_available_apps(self):
raise Exception(
- 'Please define available_apps in TransactionTestCase and its '
- 'subclasses.'
+ 'Please define available_apps in TransactionTestCase and its subclasses.'
)
TransactionTestCase.available_apps = property(no_available_apps)
TestCase.available_apps = None
diff --git a/tests/shell/tests.py b/tests/shell/tests.py
index df32562f6b..aadd618109 100644
--- a/tests/shell/tests.py
+++ b/tests/shell/tests.py
@@ -11,10 +11,7 @@ from django.test.utils import captured_stdin, captured_stdout
class ShellCommandTestCase(SimpleTestCase):
script_globals = 'print("__name__" in globals())'
script_with_inline_function = (
- 'import django\n'
- 'def f():\n'
- ' print(django.__version__)\n'
- 'f()'
+ 'import django\ndef f():\n print(django.__version__)\nf()'
)
def test_command_option(self):
diff --git a/tests/template_tests/filter_tests/test_urlizetrunc.py b/tests/template_tests/filter_tests/test_urlizetrunc.py
index e37e277212..09bbe776cf 100644
--- a/tests/template_tests/filter_tests/test_urlizetrunc.py
+++ b/tests/template_tests/filter_tests/test_urlizetrunc.py
@@ -60,14 +60,13 @@ class FunctionTests(SimpleTestCase):
self.assertEqual(
urlizetrunc(uri, 1),
- '<a href="http://31characteruri.com/test/"'
- ' rel="nofollow">…</a>',
+ '<a href="http://31characteruri.com/test/" rel="nofollow">…</a>',
)
def test_overtruncate(self):
self.assertEqual(
- urlizetrunc('http://short.com/', 20), '<a href='
- '"http://short.com/" rel="nofollow">http://short.com/</a>',
+ urlizetrunc('http://short.com/', 20),
+ '<a href="http://short.com/" rel="nofollow">http://short.com/</a>',
)
def test_query_string(self):
diff --git a/tests/template_tests/syntax_tests/i18n/test_get_language_info.py b/tests/template_tests/syntax_tests/i18n/test_get_language_info.py
index 51e8d2bc79..4ae8186af5 100644
--- a/tests/template_tests/syntax_tests/i18n/test_get_language_info.py
+++ b/tests/template_tests/syntax_tests/i18n/test_get_language_info.py
@@ -36,7 +36,7 @@ class I18nGetLanguageInfoTagTests(SimpleTestCase):
output = self.engine.render_to_string('i18n38')
self.assertEqual(output, 'de: German/Deutsch/německy bidi=False')
- @setup({'template': '{% load i18n %}''{% get_language_info %}'})
+ @setup({'template': '{% load i18n %}{% get_language_info %}'})
def test_no_for_as(self):
msg = "'get_language_info' requires 'for string as variable' (got [])"
with self.assertRaisesMessage(TemplateSyntaxError, msg):
diff --git a/tests/template_tests/test_custom.py b/tests/template_tests/test_custom.py
index cade3e4610..59f83d80e2 100644
--- a/tests/template_tests/test_custom.py
+++ b/tests/template_tests/test_custom.py
@@ -104,8 +104,7 @@ class SimpleTagTests(TagTestCase):
(
"'simple_keyword_only_param' received multiple values for "
"keyword argument 'kwarg'",
- '{% load custom %}{% simple_keyword_only_param kwarg=42 '
- 'kwarg=37 %}',
+ '{% load custom %}{% simple_keyword_only_param kwarg=42 kwarg=37 %}',
),
(
"'simple_keyword_only_default' received multiple values for "
diff --git a/tests/test_runner/test_discover_runner.py b/tests/test_runner/test_discover_runner.py
index 0012be5a7e..9cefef60ec 100644
--- a/tests/test_runner/test_discover_runner.py
+++ b/tests/test_runner/test_discover_runner.py
@@ -445,8 +445,7 @@ class DiscoverRunnerTests(SimpleTestCase):
def test_pdb_with_parallel(self):
msg = (
- 'You cannot use --pdb with parallel tests; pass --parallel=1 to '
- 'use it.'
+ 'You cannot use --pdb with parallel tests; pass --parallel=1 to use it.'
)
with self.assertRaisesMessage(ValueError, msg):
DiscoverRunner(pdb=True, parallel=2)
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index aea293bcd4..0e0d05e335 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -462,8 +462,7 @@ class AssertNumQueriesContextManagerTests(TestCase):
def test_failure(self):
msg = (
- '1 != 2 : 1 queries executed, 2 expected\nCaptured queries were:\n'
- '1.'
+ '1 != 2 : 1 queries executed, 2 expected\nCaptured queries were:\n1.'
)
with self.assertRaisesMessage(AssertionError, msg):
with self.assertNumQueries(2):
diff --git a/tests/validators/tests.py b/tests/validators/tests.py
index 98da8b012c..fcad6db85f 100644
--- a/tests/validators/tests.py
+++ b/tests/validators/tests.py
@@ -134,8 +134,7 @@ VALID_URLS = [
'ample.com',
'http://example.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
'aaaaa.com',
- 'http://example.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
- 'aaaaa',
+ 'http://example.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
'http://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaa'
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaa'
'aaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaaaaaaaaaaaa'
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 7c49fa51f3..8de82fbc63 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -635,14 +635,12 @@ class ExceptionReporterTests(SimpleTestCase):
html,
)
self.assertIn(
- '"generated", line 2, in funcName\n'
- ' &lt;source code not available&gt;',
+ '"generated", line 2, in funcName\n &lt;source code not available&gt;',
html,
)
text = reporter.get_traceback_text()
self.assertIn(
- '"generated", line 2, in funcName\n'
- ' <source code not available>',
+ '"generated", line 2, in funcName\n <source code not available>',
text,
)
@@ -676,14 +674,12 @@ class ExceptionReporterTests(SimpleTestCase):
html,
)
self.assertIn(
- '"generated", line 2, in funcName\n'
- ' &lt;source code not available&gt;',
+ '"generated", line 2, in funcName\n &lt;source code not available&gt;',
html,
)
text = reporter.get_traceback_text()
self.assertIn(
- '"generated", line 2, in funcName\n'
- ' <source code not available>',
+ '"generated", line 2, in funcName\n <source code not available>',
text,
)