From 080359c4c5242ef69ac8c58c92f240e71121ffd7 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Sun, 31 Jul 2022 07:48:52 +0200 Subject: [4.0.x] Fixed warnings per flake8 5.0.0. Backport of c18861804feb6a97afbeabb51be748dd60a04458 from main. --- tests/forms_tests/tests/test_forms.py | 41 ++++++++----- tests/forms_tests/tests/test_formsets.py | 101 +++++++++++++++++-------------- 2 files changed, 80 insertions(+), 62 deletions(-) (limited to 'tests/forms_tests') diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py index 1972d34685..d1b5f8468d 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -129,9 +129,12 @@ class FormsTestCase(SimpleTestCase): self.assertHTMLEqual( "\n".join(form_output), - """ - -""", + '" + '" + '", ) form_output = [] @@ -828,10 +831,12 @@ class FormsTestCase(SimpleTestCase): f = BeatleForm(auto_id=False) self.assertHTMLEqual( "\n".join(str(bf) for bf in f["name"]), - """ - - -""", + '' + '' + '" + '", ) self.assertHTMLEqual( "\n".join("
%s
" % bf for bf in f["name"]), @@ -2034,8 +2039,10 @@ class FormsTestCase(SimpleTestCase): p = UserRegistration(auto_id=False) self.assertHTMLEqual( p.as_ul(), - """
  • Username:
  • -
  • Password:
  • """, + '
  • Username: ' + "
  • " + '
  • Password:
  • ", ) def test_specifying_labels(self): @@ -2125,8 +2132,9 @@ class FormsTestCase(SimpleTestCase): p = UserRegistration(auto_id=False) self.assertHTMLEqual( p.as_ul(), - """
  • Username:
  • -
  • Password:
  • """, + '
  • Username: ' + "
  • " + '
  • Password:
  • ', ) p = UserRegistration(auto_id="id_%s") self.assertHTMLEqual( @@ -2743,11 +2751,12 @@ Options: -e.g., user@example.com -
  • -Password: -Wählen Sie mit Bedacht.
  • """, + '
  • Username: ' + 'e.g., user@example.com
  • ' + '
  • ' + 'Password: ' + 'Wählen Sie mit Bedacht.
  • ', ) # help_text is not displayed for hidden fields. It can be used for documentation diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py index 31abbdf9f8..0ae0bb18cf 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -227,10 +227,11 @@ class FormsFormsetTestCase(SimpleTestCase): ) self.assertHTMLEqual( "\n".join(form.as_ul() for form in formset.forms), - """
  • Choice:
  • -
  • Votes:
  • -
  • Choice:
  • -
  • Votes:
  • """, + '
  • Choice: ' + "
  • " + '
  • Votes:
  • ' + '
  • Choice:
  • ' + '
  • Votes:
  • ', ) def test_blank_form_unfilled(self): @@ -484,14 +485,15 @@ class FormsFormsetTestCase(SimpleTestCase): formset = ChoiceFormSet(initial=initial, auto_id=False, prefix="choices") self.assertHTMLEqual( "\n".join(form.as_ul() for form in formset.forms), - """
  • Choice:
  • -
  • Votes:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Choice:
  • -
  • Votes:
  • """, + '
  • Choice: ' + "
  • " + '
  • Votes:
  • ' + '
  • Choice:
  • ' + '
  • Votes:
  • ' + '
  • Choice:
  • ' + '
  • Votes:
  • ' + '
  • Choice:
  • ' + '
  • Votes:
  • ', ) # Retrieving an empty form works. Tt shows up in the form list. self.assertTrue(formset.empty_form.empty_permitted) @@ -515,15 +517,17 @@ class FormsFormsetTestCase(SimpleTestCase): formset = ChoiceFormSet(initial=initial, auto_id=False, prefix="choices") self.assertHTMLEqual( "\n".join(form.as_ul() for form in formset.forms), - """
  • Choice:
  • -
  • Votes:
  • -
  • Delete:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Delete:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Delete:
  • """, + '
  • Choice: ' + "
  • " + '
  • Votes:
  • ' + '
  • Delete:
  • ' + '
  • Choice: ' + "
  • " + '
  • Votes:
  • ' + '
  • Delete:
  • ' + '
  • Choice:
  • ' + '
  • Votes:
  • ' + '
  • Delete:
  • ', ) # To delete something, set that form's special delete field to 'on'. # Let's go ahead and delete Fergie. @@ -658,15 +662,17 @@ class FormsFormsetTestCase(SimpleTestCase): formset = ChoiceFormSet(initial=initial, auto_id=False, prefix="choices") self.assertHTMLEqual( "\n".join(form.as_ul() for form in formset.forms), - """
  • Choice:
  • -
  • Votes:
  • -
  • Order:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Order:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Order:
  • """, + '
  • Choice: ' + "
  • " + '
  • Votes:
  • ' + '
  • Order:
  • ' + '
  • Choice: ' + "
  • " + '
  • Votes:
  • ' + '
  • Order:
  • ' + '
  • Choice:
  • ' + '
  • Votes:
  • ' + '
  • Order:
  • ', ) data = { "choices-TOTAL_FORMS": "3", # the number of forms rendered @@ -784,22 +790,25 @@ class FormsFormsetTestCase(SimpleTestCase): formset = ChoiceFormSet(initial=initial, auto_id=False, prefix="choices") self.assertHTMLEqual( "\n".join(form.as_ul() for form in formset.forms), - """
  • Choice:
  • -
  • Votes:
  • -
  • Order:
  • -
  • Delete:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Order:
  • -
  • Delete:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Order:
  • -
  • Delete:
  • -
  • Choice:
  • -
  • Votes:
  • -
  • Order:
  • -
  • Delete:
  • """, + '
  • Choice: ' + "
  • " + '
  • Votes:
  • ' + '
  • Order:
  • ' + '
  • Delete:
  • ' + '
  • Choice: ' + "
  • " + '
  • Votes:
  • ' + '
  • Order:
  • ' + '
  • Delete:
  • ' + '
  • Choice:
  • ' + '
  • Votes:
  • ' + '
  • Order:
  • ' + '
  • Delete:
  • ' + '
  • Choice:
  • ' + '
  • Votes:
  • ' + '
  • Order:
  • ' + '
  • Delete:
  • ', ) # Let's delete Fergie, and put The Decemberists ahead of Calexico. data = { -- cgit v1.3