'
diff --git a/tests/test_bootstrap_field_input_text.py b/tests/test_bootstrap_field_input_text.py
index 623c73b7..c12abd2a 100644
--- a/tests/test_bootstrap_field_input_text.py
+++ b/tests/test_bootstrap_field_input_text.py
@@ -146,21 +146,23 @@ def test_input_type_text_more(self):
),
)
- self.assertHTMLEqual(
- self.render(
- "{% bootstrap_field form.test layout='horizontal' %}",
- context={"form": form},
+ (
+ self.assertHTMLEqual(
+ self.render(
+ "{% bootstrap_field form.test layout='horizontal' %}",
+ context={"form": form},
+ ),
+ (
+ '
'
+ '
'
+ ''
+ "
"
+ "
"
+ ),
),
- (
- '
'
- '
'
- ''
- "
"
- "
"
- ),
- ),
+ )
self.assertHTMLEqual(
self.render(
@@ -180,9 +182,7 @@ def test_input_validation_failure(self):
form = CharFieldRequiredTestForm(data={"test": ""})
self.assertFalse(form.is_valid())
- html = self.render(
- '{% bootstrap_field form.test addon_before="foo" %}', context={"form": form}
- )
+ html = self.render('{% bootstrap_field form.test addon_before="foo" %}', context={"form": form})
if DJANGO_VERSION >= "5":
html = html.replace(' aria-invalid="true"', "")
@@ -301,21 +301,23 @@ class PasswordTestForm(forms.Form):
),
)
- self.assertHTMLEqual(
- self.render(
- "{% bootstrap_field form.test layout='horizontal' %}",
- context={"form": form},
- ),
- (
- '
'
- '
'
- ''
- "
"
- "
"
+ (
+ self.assertHTMLEqual(
+ self.render(
+ "{% bootstrap_field form.test layout='horizontal' %}",
+ context={"form": form},
+ ),
+ (
+ '
'
+ '
'
+ ''
+ "
"
+ "
"
+ ),
),
- ),
+ )
self.assertHTMLEqual(
self.render(
diff --git a/tests/test_bootstrap_form.py b/tests/test_bootstrap_form.py
index a824e6b2..52e67078 100644
--- a/tests/test_bootstrap_form.py
+++ b/tests/test_bootstrap_form.py
@@ -6,12 +6,8 @@
class FormTestForm(forms.Form):
- required_text = forms.CharField(
- required=True, help_text="
required_text_help"
- )
- optional_text = forms.CharField(
- required=False, help_text="
required_text_help"
- )
+ required_text = forms.CharField(required=True, help_text="
required_text_help")
+ optional_text = forms.CharField(required=False, help_text="
required_text_help")
class ShowLabelTestForm(forms.Form):
@@ -66,9 +62,7 @@ def test_error_css_class(self):
)
self.assertIn("custom-error-class", html)
- html = self.render(
- '{% bootstrap_form form error_css_class="" %}', {"form": form}
- )
+ html = self.render('{% bootstrap_form form error_css_class="" %}', {"form": form})
self.assertNotIn("django_bootstrap5-err", html)
def test_required_css_class(self):
@@ -82,9 +76,7 @@ def test_required_css_class(self):
)
self.assertIn("custom-required-class", html)
- html = self.render(
- '{% bootstrap_form form required_css_class="" %}', {"form": form}
- )
+ html = self.render('{% bootstrap_form form required_css_class="" %}', {"form": form})
self.assertNotIn("django_bootstrap5-req", html)
def test_success_css_class(self):
@@ -103,25 +95,19 @@ def test_success_css_class(self):
form = FormTestForm({"subject": "subject"})
- html = self.render(
- '{% bootstrap_form form success_css_class="" %}', {"form": form}
- )
+ html = self.render('{% bootstrap_form form success_css_class="" %}', {"form": form})
self.assertNotIn("django_bootstrap5-success", html)
def test_alert_error_type(self):
form = NonFieldErrorTestForm({"subject": "subject"})
- html = self.render(
- "{% bootstrap_form form alert_error_type='all' %}", {"form": form}
- )
+ html = self.render("{% bootstrap_form form alert_error_type='all' %}", {"form": form})
soup = BeautifulSoup(html, "html.parser")
errors = list(soup.select(".text-danger")[0].stripped_strings)
self.assertIn(form.non_field_error_message, errors)
self.assertIn("This field is required.", errors)
- html = self.render(
- "{% bootstrap_form form alert_error_type='non_fields' %}", {"form": form}
- )
+ html = self.render("{% bootstrap_form form alert_error_type='non_fields' %}", {"form": form})
self.assertEqual(
html,
self.render("{% bootstrap_form form %}", {"form": form}),
@@ -133,17 +119,13 @@ def test_alert_error_type(self):
self.assertIn(form.non_field_error_message, errors)
self.assertNotIn("This field is required.", errors)
- html = self.render(
- "{% bootstrap_form form alert_error_type='fields' %}", {"form": form}
- )
+ html = self.render("{% bootstrap_form form alert_error_type='fields' %}", {"form": form})
soup = BeautifulSoup(html, "html.parser")
errors = list(soup.select(".text-danger")[0].stripped_strings)
self.assertNotIn(form.non_field_error_message, errors)
self.assertIn("This field is required.", errors)
- html = self.render(
- "{% bootstrap_form form alert_error_type='none' %}", {"form": form}
- )
+ html = self.render("{% bootstrap_form form alert_error_type='none' %}", {"form": form})
soup = BeautifulSoup(html, "html.parser")
self.assertFalse(soup.select(".text-danger"))
@@ -169,9 +151,7 @@ def test_show_label_false(self):
def test_show_label_sr_only(self):
self.assertInHTML(
'
',
- self.render(
- "{% bootstrap_form form show_label='' %}", {"form": ShowLabelTestForm()}
- ),
+ self.render("{% bootstrap_form form show_label='' %}", {"form": ShowLabelTestForm()}),
)
def test_show_label_skip(self):