From c18861804feb6a97afbeabb51be748dd60a04458 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Sun, 31 Jul 2022 07:48:52 +0200 Subject: Fixed warnings per flake8 5.0.0. --- 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 ec911ee961..6005472194 100644 --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -130,9 +130,12 @@ class FormsTestCase(SimpleTestCase): self.assertHTMLEqual( "\n".join(form_output), - """ - -""", + '" + '" + '", ) form_output = [] @@ -893,10 +896,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"]), @@ -2229,8 +2234,10 @@ class FormsTestCase(SimpleTestCase): p = UserRegistration(auto_id=False) self.assertHTMLEqual( p.as_ul(), - """
  • Username:
  • -
  • Password:
  • """, + '
  • Username: ' + "
  • " + '
  • Password:
  • ", ) def test_specifying_labels(self): @@ -2320,8 +2327,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( @@ -2945,11 +2953,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 d159409afa..96a2189d70 100644 --- a/tests/forms_tests/tests/test_formsets.py +++ b/tests/forms_tests/tests/test_formsets.py @@ -245,10 +245,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): @@ -564,14 +565,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) @@ -595,15 +597,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. @@ -738,15 +742,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 @@ -864,22 +870,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