Skip to content

test_uni_form_invalid_helper does not kick up a TemplateSyntaxError #121

calvinchengx opened this Issue Nov 19, 2011 · 0 comments

1 participant

def test_uni_form_invalid_helper(self):
    template = get_template_from_string(u"""
        {% load uni_form_tags %}
        {% uni_form form form_helper %}
    c = Context({'form': TestForm(), 'form_helper': "invalid"})

    settings.UNIFORM_FAIL_SILENTLY = False
    if settings.TEMPLATE_DEBUG:
        self.assertRaises(TemplateSyntaxError, lambda:template.render(c))
        self.assertRaises(TypeError, lambda:template.render(c))
    del settings.UNIFORM_FAIL_SILENTLY

This unit test should kick up a template syntax error when settings.TEMPLATE_DEBUG is true.

However, I am still seeing TypeError instead of a TemplateSyntaxError.

Reference traceback as follows:

./ test uni_form
Creating test database for alias 'default'...


ERROR: test_uni_form_invalid_helper (uni_form.tests.tests.TestFormHelpers)

Traceback (most recent call last):
File "/Users/calvin/.virtualenvs/booking/src/django-uni-form/uni_form/tests/", line 218, in test_uni_form_invalid_helper
print 2, template.render(c)
File "/Users/calvin/.virtualenvs/booking/src/django/django/template/", line 139, in render
return self._render(context)
File "/Users/calvin/.virtualenvs/booking/src/django/django/test/", line 62, in instrumented_test_render
return self.nodelist.render(context)
File "/Users/calvin/.virtualenvs/booking/src/django/django/template/", line 823, in render
bit = self.render_node(node, context)
File "/Users/calvin/.virtualenvs/booking/src/django/django/template/", line 73, in render_node
return node.render(context)
File "/Users/calvin/.virtualenvs/booking/src/django-uni-form/uni_form/templatetags/", line 147, in render
c = self.get_render(context)
File "/Users/calvin/.virtualenvs/booking/src/django-uni-form/uni_form/templatetags/", line 83, in get_render
raise TypeError('helper object provided to uni_form tag must be a uni_form.helpers.FormHelper object.')
TypeError: helper object provided to uni_form tag must be a uni_form.helpers.FormHelper object.

Ran 22 tests in 0.257s

FAILED (errors=1)

Am I missing something here or is this unit test not updated yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.