Created
July 1, 2020 19:23
-
-
Save smithdc1/159f45831a2ce103331c2c9ac20d49dd to your computer and use it in GitHub Desktop.
Django Pull #12752 with Crispy-forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
============================= test session starts ============================= | |
platform win32 -- Python 3.9.0a6, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 | |
django: settings: crispy_forms.tests.test_settings (from option) | |
rootdir: C:\Users\smith\PycharmProjects\django-crispy-forms, inifile: setup.cfg | |
plugins: cov-2.8.1, django-3.9.0 | |
collected 556 items | |
crispy_forms\tests\test_dynamic_api.py ................................. [ 5%] | |
............................................................sss [ 17%] | |
crispy_forms\tests\test_form_helper.py ................................. [ 23%] | |
........................................................................ [ 36%] | |
................................sss.sssss.ssss.s...ss.ssss.s...ss.sss.ss [ 49%] | |
ss.sss.sss.sss.....ss.sss.s [ 53%] | |
crispy_forms\tests\test_layout.py ...............................F...Fss [ 60%] | |
sF.......F.........................sss.ssss...sss.ss.ssss.....sss. [ 72%] | |
crispy_forms\tests\test_layout_objects.py ............................s. [ 78%] | |
..s...s...s...s...s...s...s...s...s...s...s...s...s... [ 87%] | |
crispy_forms\tests\test_tags.py ........................................ [ 94%] | |
....s..F [ 96%] | |
crispy_forms\tests\test_utils.py .................... [100%] | |
================================== FAILURES =================================== | |
___________ test_change_layout_dynamically_delete_field[bootstrap4] ___________ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165C089E20>) (literal <django.template.base.FilterExpression object at 0x000002165C089BE0>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C173F70>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
def eval(self, context): | |
try: | |
> return func(context, self.first, self.second) | |
..\django2\django\template\smartif.py:62: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C173F70>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
x = (literal <django.template.base.FilterExpression object at 0x000002165C089E20>) | |
y = (literal <django.template.base.FilterExpression object at 0x000002165C089BE0>) | |
> 'in': infix(9, lambda context, x, y: x.eval(context) in y.eval(context)), | |
'not in': infix(9, lambda context, x, y: x.eval(context) not in y.eval(context)), | |
'is': infix(10, lambda context, x, y: x.eval(context) is y.eval(context)), | |
'is not': infix(10, lambda context, x, y: x.eval(context) is not y.eval(context)), | |
'==': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)), | |
'!=': infix(10, lambda context, x, y: x.eval(context) != y.eval(context)), | |
'>': infix(10, lambda context, x, y: x.eval(context) > y.eval(context)), | |
'>=': infix(10, lambda context, x, y: x.eval(context) >= y.eval(context)), | |
'<': infix(10, lambda context, x, y: x.eval(context) < y.eval(context)), | |
'<=': infix(10, lambda context, x, y: x.eval(context) <= y.eval(context)), | |
} | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:120: TypeError | |
During handling of the above exception, another exception occurred: | |
def test_change_layout_dynamically_delete_field(): | |
template = Template( | |
""" | |
{% load crispy_forms_tags %} | |
{% crispy form form_helper %} | |
""" | |
) | |
form = SampleForm() | |
form_helper = FormHelper() | |
form_helper.add_layout( | |
Layout( | |
Fieldset("Company Data", "is_company", "email", "password1", "password2", css_id="multifield_info",), | |
Column("first_name", "last_name", css_id="column_name",), | |
) | |
) | |
# We remove email field on the go | |
# Layout needs to be adapted for the new form fields | |
del form.fields["email"] | |
del form_helper.layout.fields[0].fields[1] | |
c = Context({"form": form, "form_helper": form_helper}) | |
> html = template.render(c) | |
crispy_forms\tests\test_layout.py:215: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
..\django2\django\template\base.py:170: in render | |
return self._render(context) | |
..\django2\django\test\utils.py:96: in instrumented_test_render | |
return self.nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
crispy_forms\templatetags\crispy_forms_tags.py:203: in render | |
c = self.get_render(context).flatten() | |
crispy_forms\templatetags\crispy_forms_tags.py:119: in get_render | |
actual_form.form_html = helper.render_layout( | |
crispy_forms\helper.py:301: in render_layout | |
html = self.layout.render(form, self.form_style, context, template_pack=template_pack) | |
crispy_forms\layout.py:135: in render | |
return self.get_rendered_fields(form, form_style, context, template_pack, **kwargs) | |
crispy_forms\layout.py:96: in get_rendered_fields | |
return "".join( | |
crispy_forms\layout.py:97: in <genexpr> | |
render_field(field, form, form_style, context, template_pack=template_pack, **kwargs) | |
crispy_forms\utils.py:66: in render_field | |
return field.render(form, form_style, context, template_pack=template_pack,) | |
crispy_forms\layout.py:370: in render | |
return render_to_string(template, {"div": self, "fields": fields}) | |
..\django2\django\template\loader.py:62: in render_to_string | |
return template.render(context, request) | |
..\django2\django\template\backends\django.py:61: in render | |
return self.template.render(context) | |
..\django2\django\template\base.py:170: in render | |
return self._render(context) | |
..\django2\django\test\utils.py:96: in instrumented_test_render | |
return self.nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
..\django2\django\template\defaulttags.py:305: in render | |
match = condition.eval(context) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165C089E20>) (literal <django.template.base.FilterExpression object at 0x000002165C089BE0>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C173F70>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
def eval(self, context): | |
try: | |
return func(context, self.first, self.second) | |
except Exception as e: | |
exception_str = type(e).__name__ | |
msg = str(e) | |
if msg: | |
exception_str = "%s: %s" % (exception_str, msg) | |
> warnings.warn( | |
"Evaluating an {%% if %%} in a template raised an " | |
"exception. In Django 4.1, this exception will be raised " | |
"rather than silenced. The exception was:\n%s" % | |
exception_str, | |
RemovedInDjango41Warning, | |
) | |
E django.utils.deprecation.RemovedInDjango41Warning: Evaluating an {% if %} in a template raised an exception. In Django 4.1, this exception will be raised rather than silenced. The exception was: | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:68: RemovedInDjango41Warning | |
___________________ test_column_has_css_classes[bootstrap4] ___________________ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165C4EB970>) (literal <django.template.base.FilterExpression object at 0x000002165C4EB190>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C49A6D0>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
def eval(self, context): | |
try: | |
> return func(context, self.first, self.second) | |
..\django2\django\template\smartif.py:62: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C49A6D0>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
x = (literal <django.template.base.FilterExpression object at 0x000002165C4EB970>) | |
y = (literal <django.template.base.FilterExpression object at 0x000002165C4EB190>) | |
> 'in': infix(9, lambda context, x, y: x.eval(context) in y.eval(context)), | |
'not in': infix(9, lambda context, x, y: x.eval(context) not in y.eval(context)), | |
'is': infix(10, lambda context, x, y: x.eval(context) is y.eval(context)), | |
'is not': infix(10, lambda context, x, y: x.eval(context) is not y.eval(context)), | |
'==': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)), | |
'!=': infix(10, lambda context, x, y: x.eval(context) != y.eval(context)), | |
'>': infix(10, lambda context, x, y: x.eval(context) > y.eval(context)), | |
'>=': infix(10, lambda context, x, y: x.eval(context) >= y.eval(context)), | |
'<': infix(10, lambda context, x, y: x.eval(context) < y.eval(context)), | |
'<=': infix(10, lambda context, x, y: x.eval(context) <= y.eval(context)), | |
} | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:120: TypeError | |
During handling of the above exception, another exception occurred: | |
settings = <pytest_django.fixtures.SettingsWrapper object at 0x000002165C49AA30> | |
def test_column_has_css_classes(settings): | |
template = Template( | |
""" | |
{% load crispy_forms_tags %} | |
{% crispy form form_helper %} | |
""" | |
) | |
form = SampleForm() | |
form_helper = FormHelper() | |
form_helper.add_layout( | |
Layout( | |
Fieldset("Company Data", "is_company", "email", "password1", "password2", css_id="multifield_info",), | |
Column("first_name", "last_name",), | |
) | |
) | |
c = Context({"form": form, "form_helper": form_helper}) | |
> html = template.render(c) | |
crispy_forms\tests\test_layout.py:237: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
..\django2\django\template\base.py:170: in render | |
return self._render(context) | |
..\django2\django\test\utils.py:96: in instrumented_test_render | |
return self.nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
crispy_forms\templatetags\crispy_forms_tags.py:203: in render | |
c = self.get_render(context).flatten() | |
crispy_forms\templatetags\crispy_forms_tags.py:119: in get_render | |
actual_form.form_html = helper.render_layout( | |
crispy_forms\helper.py:301: in render_layout | |
html = self.layout.render(form, self.form_style, context, template_pack=template_pack) | |
crispy_forms\layout.py:135: in render | |
return self.get_rendered_fields(form, form_style, context, template_pack, **kwargs) | |
crispy_forms\layout.py:96: in get_rendered_fields | |
return "".join( | |
crispy_forms\layout.py:97: in <genexpr> | |
render_field(field, form, form_style, context, template_pack=template_pack, **kwargs) | |
crispy_forms\utils.py:66: in render_field | |
return field.render(form, form_style, context, template_pack=template_pack,) | |
crispy_forms\layout.py:370: in render | |
return render_to_string(template, {"div": self, "fields": fields}) | |
..\django2\django\template\loader.py:62: in render_to_string | |
return template.render(context, request) | |
..\django2\django\template\backends\django.py:61: in render | |
return self.template.render(context) | |
..\django2\django\template\base.py:170: in render | |
return self._render(context) | |
..\django2\django\test\utils.py:96: in instrumented_test_render | |
return self.nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
..\django2\django\template\defaulttags.py:305: in render | |
match = condition.eval(context) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165C4EB970>) (literal <django.template.base.FilterExpression object at 0x000002165C4EB190>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C49A6D0>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
def eval(self, context): | |
try: | |
return func(context, self.first, self.second) | |
except Exception as e: | |
exception_str = type(e).__name__ | |
msg = str(e) | |
if msg: | |
exception_str = "%s: %s" % (exception_str, msg) | |
> warnings.warn( | |
"Evaluating an {%% if %%} in a template raised an " | |
"exception. In Django 4.1, this exception will be raised " | |
"rather than silenced. The exception was:\n%s" % | |
exception_str, | |
RemovedInDjango41Warning, | |
) | |
E django.utils.deprecation.RemovedInDjango41Warning: Evaluating an {% if %} in a template raised an exception. In Django 4.1, this exception will be raised rather than silenced. The exception was: | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:68: RemovedInDjango41Warning | |
___________________ test_bs4_column_css_classes[bootstrap4] ___________________ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165C65A970>) (literal <django.template.base.FilterExpression object at 0x000002165C65ACA0>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C4BBEB0>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
def eval(self, context): | |
try: | |
> return func(context, self.first, self.second) | |
..\django2\django\template\smartif.py:62: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C4BBEB0>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
x = (literal <django.template.base.FilterExpression object at 0x000002165C65A970>) | |
y = (literal <django.template.base.FilterExpression object at 0x000002165C65ACA0>) | |
> 'in': infix(9, lambda context, x, y: x.eval(context) in y.eval(context)), | |
'not in': infix(9, lambda context, x, y: x.eval(context) not in y.eval(context)), | |
'is': infix(10, lambda context, x, y: x.eval(context) is y.eval(context)), | |
'is not': infix(10, lambda context, x, y: x.eval(context) is not y.eval(context)), | |
'==': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)), | |
'!=': infix(10, lambda context, x, y: x.eval(context) != y.eval(context)), | |
'>': infix(10, lambda context, x, y: x.eval(context) > y.eval(context)), | |
'>=': infix(10, lambda context, x, y: x.eval(context) >= y.eval(context)), | |
'<': infix(10, lambda context, x, y: x.eval(context) < y.eval(context)), | |
'<=': infix(10, lambda context, x, y: x.eval(context) <= y.eval(context)), | |
} | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:120: TypeError | |
During handling of the above exception, another exception occurred: | |
settings = <pytest_django.fixtures.SettingsWrapper object at 0x000002165C650910> | |
@only_bootstrap4 | |
def test_bs4_column_css_classes(settings): | |
template = Template( | |
""" | |
{% load crispy_forms_tags %} | |
{% crispy form form_helper %} | |
""" | |
) | |
form = SampleForm() | |
form_helper = FormHelper() | |
form_helper.add_layout( | |
Layout( | |
Column("first_name", "last_name",), | |
Column("first_name", "last_name", css_class="col-sm"), | |
Column("first_name", "last_name", css_class="mb-4"), | |
) | |
) | |
c = Context({"form": form, "form_helper": form_helper}) | |
> html = template.render(c) | |
crispy_forms\tests\test_layout.py:267: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
..\django2\django\template\base.py:170: in render | |
return self._render(context) | |
..\django2\django\test\utils.py:96: in instrumented_test_render | |
return self.nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
crispy_forms\templatetags\crispy_forms_tags.py:203: in render | |
c = self.get_render(context).flatten() | |
crispy_forms\templatetags\crispy_forms_tags.py:119: in get_render | |
actual_form.form_html = helper.render_layout( | |
crispy_forms\helper.py:301: in render_layout | |
html = self.layout.render(form, self.form_style, context, template_pack=template_pack) | |
crispy_forms\layout.py:135: in render | |
return self.get_rendered_fields(form, form_style, context, template_pack, **kwargs) | |
crispy_forms\layout.py:96: in get_rendered_fields | |
return "".join( | |
crispy_forms\layout.py:97: in <genexpr> | |
render_field(field, form, form_style, context, template_pack=template_pack, **kwargs) | |
crispy_forms\utils.py:66: in render_field | |
return field.render(form, form_style, context, template_pack=template_pack,) | |
crispy_forms\layout.py:370: in render | |
return render_to_string(template, {"div": self, "fields": fields}) | |
..\django2\django\template\loader.py:62: in render_to_string | |
return template.render(context, request) | |
..\django2\django\template\backends\django.py:61: in render | |
return self.template.render(context) | |
..\django2\django\template\base.py:170: in render | |
return self._render(context) | |
..\django2\django\test\utils.py:96: in instrumented_test_render | |
return self.nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
..\django2\django\template\defaulttags.py:305: in render | |
match = condition.eval(context) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165C65A970>) (literal <django.template.base.FilterExpression object at 0x000002165C65ACA0>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'div': <crispy_forms.layout.Column object at 0x000002165C4BBEB0>, 'fie... \n\n\n \n\n\n\n\n \n\n\n\n </div>\n \n \n </div>\n \n\n'}] | |
def eval(self, context): | |
try: | |
return func(context, self.first, self.second) | |
except Exception as e: | |
exception_str = type(e).__name__ | |
msg = str(e) | |
if msg: | |
exception_str = "%s: %s" % (exception_str, msg) | |
> warnings.warn( | |
"Evaluating an {%% if %%} in a template raised an " | |
"exception. In Django 4.1, this exception will be raised " | |
"rather than silenced. The exception was:\n%s" % | |
exception_str, | |
RemovedInDjango41Warning, | |
) | |
E django.utils.deprecation.RemovedInDjango41Warning: Evaluating an {% if %} in a template raised an exception. In Django 4.1, this exception will be raised rather than silenced. The exception was: | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:68: RemovedInDjango41Warning | |
____________________ test_modelformset_layout[bootstrap4] _____________________ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165BFD0B20>) (literal <django.template.base.FilterExpression object at 0x000002165BFD0C70>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'True': True, 'False': False, 'None': None, 'form': <django.forms.form...=(email;password;id)>, 'field': <django.forms.boundfield.BoundField object at 0x000002165C4ADC40>, 'labelclass': None}] | |
def eval(self, context): | |
try: | |
> return func(context, self.first, self.second) | |
..\django2\django\template\smartif.py:62: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
context = [{'True': True, 'False': False, 'None': None}, {'True': True, 'False': False, 'None': None, 'form': <django.forms.form...=(email;password;id)>, 'field': <django.forms.boundfield.BoundField object at 0x000002165C4ADC40>, 'labelclass': None}] | |
x = (literal <django.template.base.FilterExpression object at 0x000002165BFD0B20>) | |
y = (literal <django.template.base.FilterExpression object at 0x000002165BFD0C70>) | |
> 'in': infix(9, lambda context, x, y: x.eval(context) in y.eval(context)), | |
'not in': infix(9, lambda context, x, y: x.eval(context) not in y.eval(context)), | |
'is': infix(10, lambda context, x, y: x.eval(context) is y.eval(context)), | |
'is not': infix(10, lambda context, x, y: x.eval(context) is not y.eval(context)), | |
'==': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)), | |
'!=': infix(10, lambda context, x, y: x.eval(context) != y.eval(context)), | |
'>': infix(10, lambda context, x, y: x.eval(context) > y.eval(context)), | |
'>=': infix(10, lambda context, x, y: x.eval(context) >= y.eval(context)), | |
'<': infix(10, lambda context, x, y: x.eval(context) < y.eval(context)), | |
'<=': infix(10, lambda context, x, y: x.eval(context) <= y.eval(context)), | |
} | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:120: TypeError | |
During handling of the above exception, another exception occurred: | |
def test_modelformset_layout(): | |
CrispyModelFormSet = modelformset_factory(CrispyTestModel, form=SampleForm4, extra=3) | |
formset = CrispyModelFormSet(queryset=CrispyTestModel.objects.none()) | |
helper = FormHelper() | |
helper.layout = Layout("email") | |
> html = render_crispy_form(form=formset, helper=helper) | |
crispy_forms\tests\test_layout.py:331: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
crispy_forms\utils.py:170: in render_crispy_form | |
return node.render(node_context) | |
crispy_forms\templatetags\crispy_forms_tags.py:203: in render | |
c = self.get_render(context).flatten() | |
crispy_forms\templatetags\crispy_forms_tags.py:128: in get_render | |
form.form_html = helper.render_layout(form, node_context, template_pack=self.template_pack) | |
crispy_forms\helper.py:301: in render_layout | |
html = self.layout.render(form, self.form_style, context, template_pack=template_pack) | |
crispy_forms\layout.py:135: in render | |
return self.get_rendered_fields(form, form_style, context, template_pack, **kwargs) | |
crispy_forms\layout.py:96: in get_rendered_fields | |
return "".join( | |
crispy_forms\layout.py:97: in <genexpr> | |
render_field(field, form, form_style, context, template_pack=template_pack, **kwargs) | |
crispy_forms\utils.py:139: in render_field | |
html = template.render(context) | |
..\django2\django\template\backends\django.py:61: in render | |
return self.template.render(context) | |
..\django2\django\template\base.py:170: in render | |
return self._render(context) | |
..\django2\django\test\utils.py:96: in instrumented_test_render | |
return self.nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
..\django2\django\template\defaulttags.py:312: in render | |
return nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
..\django2\django\template\defaulttags.py:312: in render | |
return nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
..\django2\django\template\defaulttags.py:305: in render | |
match = condition.eval(context) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165BFD0B20>) (literal <django.template.base.FilterExpression object at 0x000002165BFD0C70>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'True': True, 'False': False, 'None': None, 'form': <django.forms.form...=(email;password;id)>, 'field': <django.forms.boundfield.BoundField object at 0x000002165C4ADC40>, 'labelclass': None}] | |
def eval(self, context): | |
try: | |
return func(context, self.first, self.second) | |
except Exception as e: | |
exception_str = type(e).__name__ | |
msg = str(e) | |
if msg: | |
exception_str = "%s: %s" % (exception_str, msg) | |
> warnings.warn( | |
"Evaluating an {%% if %%} in a template raised an " | |
"exception. In Django 4.1, this exception will be raised " | |
"rather than silenced. The exception was:\n%s" % | |
exception_str, | |
RemovedInDjango41Warning, | |
) | |
E django.utils.deprecation.RemovedInDjango41Warning: Evaluating an {% if %} in a template raised an exception. In Django 4.1, this exception will be raised rather than silenced. The exception was: | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:68: RemovedInDjango41Warning | |
________________________ test_crispy_addon[bootstrap4] ________________________ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165C499E20>) (literal <django.template.base.FilterExpression object at 0x000002165C499040>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'True': True, 'False': False, 'None': None, 'field': <django.forms.bou...form_show_errors': True, 'form_show_labels': True, 'crispy_prepended_text': 'Work', 'crispy_appended_text': 'Primary'}] | |
def eval(self, context): | |
try: | |
> return func(context, self.first, self.second) | |
..\django2\django\template\smartif.py:62: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
context = [{'True': True, 'False': False, 'None': None}, {'True': True, 'False': False, 'None': None, 'field': <django.forms.bou...form_show_errors': True, 'form_show_labels': True, 'crispy_prepended_text': 'Work', 'crispy_appended_text': 'Primary'}] | |
x = (literal <django.template.base.FilterExpression object at 0x000002165C499E20>) | |
y = (literal <django.template.base.FilterExpression object at 0x000002165C499040>) | |
> 'in': infix(9, lambda context, x, y: x.eval(context) in y.eval(context)), | |
'not in': infix(9, lambda context, x, y: x.eval(context) not in y.eval(context)), | |
'is': infix(10, lambda context, x, y: x.eval(context) is y.eval(context)), | |
'is not': infix(10, lambda context, x, y: x.eval(context) is not y.eval(context)), | |
'==': infix(10, lambda context, x, y: x.eval(context) == y.eval(context)), | |
'!=': infix(10, lambda context, x, y: x.eval(context) != y.eval(context)), | |
'>': infix(10, lambda context, x, y: x.eval(context) > y.eval(context)), | |
'>=': infix(10, lambda context, x, y: x.eval(context) >= y.eval(context)), | |
'<': infix(10, lambda context, x, y: x.eval(context) < y.eval(context)), | |
'<=': infix(10, lambda context, x, y: x.eval(context) <= y.eval(context)), | |
} | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:120: TypeError | |
During handling of the above exception, another exception occurred: | |
settings = <pytest_django.fixtures.SettingsWrapper object at 0x000002165C4E8700> | |
@only_bootstrap | |
def test_crispy_addon(settings): | |
test_form = SampleForm() | |
field_instance = test_form.fields["email"] | |
bound_field = BoundField(test_form, field_instance, "email") | |
if settings.CRISPY_TEMPLATE_PACK == "bootstrap": | |
# prepend tests | |
assert "input-prepend" in crispy_addon(bound_field, prepend="Work") | |
assert "input-append" not in crispy_addon(bound_field, prepend="Work") | |
# append tests | |
assert "input-prepend" not in crispy_addon(bound_field, append="Primary") | |
assert "input-append" in crispy_addon(bound_field, append="Secondary") | |
# prepend and append tests | |
assert "input-append" in crispy_addon(bound_field, prepend="Work", append="Primary") | |
assert "input-prepend" in crispy_addon(bound_field, prepend="Work", append="Secondary") | |
elif settings.CRISPY_TEMPLATE_PACK == "bootstrap3": | |
assert "input-group-addon" in crispy_addon(bound_field, prepend="Work", append="Primary") | |
assert "input-group-addon" in crispy_addon(bound_field, prepend="Work", append="Secondary") | |
elif settings.CRISPY_TEMPLATE_PACK == "bootstrap4": | |
> assert "input-group-text" in crispy_addon(bound_field, prepend="Work", append="Primary") | |
crispy_forms\tests\test_tags.py:228: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
crispy_forms\templatetags\crispy_forms_field.py:198: in crispy_addon | |
return template.render(context) | |
..\django2\django\template\backends\django.py:61: in render | |
return self.template.render(context) | |
..\django2\django\template\base.py:170: in render | |
return self._render(context) | |
..\django2\django\test\utils.py:96: in instrumented_test_render | |
return self.nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
..\django2\django\template\defaulttags.py:312: in render | |
return nodelist.render(context) | |
..\django2\django\template\base.py:938: in render | |
bit = node.render_annotated(context) | |
..\django2\django\template\base.py:905: in render_annotated | |
return self.render(context) | |
..\django2\django\template\defaulttags.py:305: in render | |
match = condition.eval(context) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = (in (literal <django.template.base.FilterExpression object at 0x000002165C499E20>) (literal <django.template.base.FilterExpression object at 0x000002165C499040>)) | |
context = [{'True': True, 'False': False, 'None': None}, {'True': True, 'False': False, 'None': None, 'field': <django.forms.bou...form_show_errors': True, 'form_show_labels': True, 'crispy_prepended_text': 'Work', 'crispy_appended_text': 'Primary'}] | |
def eval(self, context): | |
try: | |
return func(context, self.first, self.second) | |
except Exception as e: | |
exception_str = type(e).__name__ | |
msg = str(e) | |
if msg: | |
exception_str = "%s: %s" % (exception_str, msg) | |
> warnings.warn( | |
"Evaluating an {%% if %%} in a template raised an " | |
"exception. In Django 4.1, this exception will be raised " | |
"rather than silenced. The exception was:\n%s" % | |
exception_str, | |
RemovedInDjango41Warning, | |
) | |
E django.utils.deprecation.RemovedInDjango41Warning: Evaluating an {% if %} in a template raised an exception. In Django 4.1, this exception will be raised rather than silenced. The exception was: | |
E TypeError: argument of type 'NoneType' is not iterable | |
..\django2\django\template\smartif.py:68: RemovedInDjango41Warning | |
=========================== short test summary info =========================== | |
FAILED crispy_forms/tests/test_layout.py::test_change_layout_dynamically_delete_field[bootstrap4] | |
FAILED crispy_forms/tests/test_layout.py::test_column_has_css_classes[bootstrap4] | |
FAILED crispy_forms/tests/test_layout.py::test_bs4_column_css_classes[bootstrap4] | |
FAILED crispy_forms/tests/test_layout.py::test_modelformset_layout[bootstrap4] | |
FAILED crispy_forms/tests/test_tags.py::test_crispy_addon[bootstrap4] - djang... | |
================== 5 failed, 467 passed, 84 skipped in 8.16s ================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment