diff options
| author | Berker Peksag <berker.peksag@gmail.com> | 2014-11-27 02:41:27 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-03 14:27:38 -0500 |
| commit | 560b4207b1490a7d0cbf70cfbeba7daf2082e5be (patch) | |
| tree | 9656c5e6a5d0de63024bb5ff2291963f4f236100 /tests | |
| parent | 50c1d8f24b0d04c813b3dd34720df86446091afa (diff) | |
Removed redundant numbered parameters from str.format().
Since Python 2.7 and 3.1, "{0} {1}" is equivalent to "{} {}".
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/file_uploads/tests.py | 4 | ||||
| -rw-r--r-- | tests/forms_tests/tests/test_forms.py | 2 | ||||
| -rw-r--r-- | tests/forms_tests/tests/tests.py | 2 | ||||
| -rw-r--r-- | tests/template_tests/tests.py | 4 | ||||
| -rw-r--r-- | tests/utils_tests/test_html.py | 2 | ||||
| -rw-r--r-- | tests/utils_tests/test_numberformat.py | 6 | ||||
| -rw-r--r-- | tests/utils_tests/test_os_utils.py | 2 |
7 files changed, 11 insertions, 11 deletions
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index 4fa75415ec..85363744d8 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -239,7 +239,7 @@ class FileUploadTests(TestCase): for name, filename, _ in cases: payload.write("\r\n".join([ '--' + client.BOUNDARY, - 'Content-Disposition: form-data; name="{0}"; filename="{1}"', + 'Content-Disposition: form-data; name="{}"; filename="{}"', 'Content-Type: application/octet-stream', '', 'Oops.', @@ -258,7 +258,7 @@ class FileUploadTests(TestCase): result = json.loads(response.content.decode('utf-8')) for name, _, expected in cases: got = result[name] - self.assertEqual(expected, got, 'Mismatch for {0}'.format(name)) + self.assertEqual(expected, got, 'Mismatch for {}'.format(name)) self.assertLess(len(got), 256, "Got a long file name (%s characters)." % len(got)) diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 6478116f02..1980e01d73 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -1384,7 +1384,7 @@ class FormsTestCase(TestCase): """ class CustomWidget(TextInput): def render(self, name, value, attrs=None): - return format_html(str('<input{0} />'), ' id=custom') + return format_html(str('<input{} />'), ' id=custom') class SampleForm(Form): name = CharField(widget=CustomWidget) diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py index d53d030158..0b3d5765a0 100644 --- a/tests/forms_tests/tests/tests.py +++ b/tests/forms_tests/tests/tests.py @@ -316,7 +316,7 @@ class EmptyLabelTestCase(TestCase): m = f.save() self.assertEqual(expected, getattr(m, key)) self.assertEqual('No Preference', - getattr(m, 'get_{0}_display'.format(key))()) + getattr(m, 'get_{}_display'.format(key))()) def test_empty_field_integer(self): f = EmptyIntegerLabelChoiceForm() diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py index 43dac24b92..d58c91f90d 100644 --- a/tests/template_tests/tests.py +++ b/tests/template_tests/tests.py @@ -319,12 +319,12 @@ class TemplateRegressionTests(TestCase): # When the IfChangeNode stores state at 'self' it stays at '3' and skip the last yielded value below. iter2 = iter([1, 2, 3]) output2 = template.render(Context({'foo': range(3), 'get_value': lambda: next(iter2)})) - self.assertEqual(output2, '[0,1,2,3]', 'Expected [0,1,2,3] in second parallel template, got {0}'.format(output2)) + self.assertEqual(output2, '[0,1,2,3]', 'Expected [0,1,2,3] in second parallel template, got {}'.format(output2)) yield 3 gen1 = gen() output1 = template.render(Context({'foo': range(3), 'get_value': lambda: next(gen1)})) - self.assertEqual(output1, '[0,1,2,3]', 'Expected [0,1,2,3] in first template, got {0}'.format(output1)) + self.assertEqual(output1, '[0,1,2,3]', 'Expected [0,1,2,3] in first template, got {}'.format(output1)) def test_cache_regression_20130(self): t = Template('{% load cache %}{% cache 1 regression_20130 %}foo{% endcache %}') diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py index ff9d7f4ac0..4023434101 100644 --- a/tests/utils_tests/test_html.py +++ b/tests/utils_tests/test_html.py @@ -43,7 +43,7 @@ class TestUtilsHtml(TestCase): def test_format_html(self): self.assertEqual( - html.format_html("{0} {1} {third} {fourth}", + html.format_html("{} {} {third} {fourth}", "< Dangerous >", html.mark_safe("<b>safe</b>"), third="< dangerous again", diff --git a/tests/utils_tests/test_numberformat.py b/tests/utils_tests/test_numberformat.py index 80f222d955..84ba378e46 100644 --- a/tests/utils_tests/test_numberformat.py +++ b/tests/utils_tests/test_numberformat.py @@ -28,13 +28,13 @@ class TestNumberFormat(TestCase): self.assertEqual(nformat('-1234.33', '.', decimal_pos=1), '-1234.3') def test_large_number(self): - most_max = ('{0}179769313486231570814527423731704356798070567525844996' + most_max = ('{}179769313486231570814527423731704356798070567525844996' '598917476803157260780028538760589558632766878171540458953' '514382464234321326889464182768467546703537516986049910576' '551282076245490090389328944075868508455133942304583236903' '222948165808559332123348274797826204144723168738177180919' - '29988125040402618412485836{1}') - most_max2 = ('{0}35953862697246314162905484746340871359614113505168999' + '29988125040402618412485836{}') + most_max2 = ('{}35953862697246314162905484746340871359614113505168999' '31978349536063145215600570775211791172655337563430809179' '07028764928468642653778928365536935093407075033972099821' '15310256415249098018077865788815173701691026788460916647' diff --git a/tests/utils_tests/test_os_utils.py b/tests/utils_tests/test_os_utils.py index 7e6c74b3da..e1bc3e5d83 100644 --- a/tests/utils_tests/test_os_utils.py +++ b/tests/utils_tests/test_os_utils.py @@ -17,7 +17,7 @@ class SafeJoinTests(unittest.TestCase): drive, path = os.path.splitdrive(safe_join("/", "path")) self.assertEqual( path, - "{0}path".format(os.path.sep), + "{}path".format(os.path.sep), ) drive, path = os.path.splitdrive(safe_join("/", "")) |
