diff --git a/tests/test_form_helper.py b/tests/test_form_helper.py
index 05aef37..de0e7d0 100644
--- a/tests/test_form_helper.py
+++ b/tests/test_form_helper.py
@@ -38,12 +38,10 @@ def test_inputs():
form_helper.add_input(Hidden("my-hidden", "Hidden"))
form_helper.add_input(Button("my-button", "Button"))
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
c = Context({"form": SampleForm(), "form_helper": form_helper})
html = template.render(c)
@@ -72,12 +70,10 @@ def test_form_with_helper_without_layout():
form_helper.form_action = "simpleAction"
form_helper.form_error_title = "ERRORS"
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy testForm form_helper %}
- """
- )
+ """)
# now we render it, with errors
form = SampleForm({"password1": "wargame", "password2": "god"})
@@ -112,12 +108,10 @@ def test_form_show_errors_non_field_errors(settings):
form.helper.form_show_errors = True
form.is_valid()
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy testForm %}
- """
- )
+ """)
# First we render with errors
c = Context({"testForm": form})
@@ -234,12 +228,10 @@ def test_template_helper_access():
def test_without_helper():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form %}
- """
- )
+ """)
c = Context({"form": SampleForm()})
html = template.render(c)
@@ -250,12 +242,10 @@ def test_without_helper():
def test_formset_with_helper_without_layout():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy testFormSet formset_helper %}
- """
- )
+ """)
form_helper = FormHelper()
form_helper.form_id = "thisFormsetRocks"
@@ -291,12 +281,10 @@ def test_formset_with_helper_without_layout():
def test_CSRF_token_POST_form():
form_helper = FormHelper()
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
# The middleware only initializes the CSRF token when processing a real request
# So using RequestContext or csrf(request) here does not work.
@@ -317,12 +305,10 @@ def test_CSRF_token_POST_form():
def test_CSRF_token_GET_form():
form_helper = FormHelper()
form_helper.form_method = "GET"
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
c = Context(
{
diff --git a/tests/test_layout.py b/tests/test_layout.py
index 470918a..8de66ae 100644
--- a/tests/test_layout.py
+++ b/tests/test_layout.py
@@ -44,12 +44,10 @@ def test_invalid_unicode_characters(settings):
form_helper = FormHelper()
form_helper.add_layout(Layout("espaƱa"))
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
c = Context({"form": SampleForm(), "form_helper": form_helper})
settings.CRISPY_FAIL_SILENTLY = False
with pytest.raises(Exception):
@@ -81,12 +79,10 @@ class Meta:
form_helper = FormHelper()
form_helper.layout = Layout("first_name")
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
c = Context({"form": form, "form_helper": form_helper})
html = template.render(c)
assert "email" not in html
@@ -96,12 +92,10 @@ def test_layout_unresolved_field(settings):
form_helper = FormHelper()
form_helper.add_layout(Layout("typo"))
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
c = Context({"form": SampleForm(), "form_helper": form_helper})
settings.CRISPY_FAIL_SILENTLY = False
with pytest.raises(Exception):
@@ -112,12 +106,10 @@ def test_double_rendered_field(settings):
form_helper = FormHelper()
form_helper.add_layout(Layout("is_company", "is_company"))
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
c = Context({"form": SampleForm(), "form_helper": form_helper})
settings.CRISPY_FAIL_SILENTLY = False
with pytest.raises(Exception):
@@ -131,14 +123,12 @@ class ExampleForm(forms.Form):
form = ExampleForm()
form2 = SampleForm()
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{{ form.as_ul }}
{% crispy form2 %}
{{ form.as_ul }}
- """
- )
+ """)
c = Context({"form": form, "form2": form2})
html = template.render(c)
@@ -168,23 +158,19 @@ def test_layout_fieldset_row_html_with_unicode_fieldnames():
css_class="rows",
),
HTML('test link'),
- HTML(
- """
+ HTML("""
{% if flag %}{{ message }}{% endif %}
- """
- ),
+ """),
"first_name",
"last_name",
),
)
)
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
c = Context(
{
"form": SampleForm(),
@@ -208,12 +194,10 @@ def test_layout_fieldset_row_html_with_unicode_fieldnames():
def test_change_layout_dynamically_delete_field():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
form = SampleForm()
form_helper = FormHelper()
@@ -246,12 +230,10 @@ def test_change_layout_dynamically_delete_field():
def test_column_has_css_classes():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
form = SampleForm()
form_helper = FormHelper()
@@ -275,12 +257,10 @@ def test_column_has_css_classes():
def test_bs4_column_css_classes():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form_helper %}
- """
- )
+ """)
form = SampleForm()
form_helper = FormHelper()
@@ -401,12 +381,10 @@ def test_modelformset_layout():
def test_i18n():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form form.helper %}
- """
- )
+ """)
form = SampleForm()
form_helper = FormHelper()
form_helper.layout = Layout(
diff --git a/tests/test_layout_objects.py b/tests/test_layout_objects.py
index 5adea3b..7ca299a 100644
--- a/tests/test_layout_objects.py
+++ b/tests/test_layout_objects.py
@@ -45,12 +45,10 @@
def test_multiwidget_field():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy form %}
- """
- )
+ """)
test_form = SampleForm()
test_form.helper = FormHelper()
@@ -76,12 +74,10 @@ def test_multiwidget_field():
def test_field_type_hidden():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_tags %}
{% crispy test_form %}
- """
- )
+ """)
test_form = SampleForm()
test_form.helper = FormHelper()
diff --git a/tests/test_tags.py b/tests/test_tags.py
index 820c1fb..a8381be 100644
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -9,25 +9,21 @@
def test_crispy_field():
- template = Template(
- """
+ template = Template("""
{% load crispy_forms_field %}
{% for field in form %}
{% crispy_field field %}
{% endfor %}
- """
- )
+ """)
html = template.render(Context({"form": SampleForm()}))
assert html.count("