From f032bbc8b107ab9274542f8d233fc88aa1c6e04d Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 7 Nov 2016 18:19:34 -0500 Subject: Refs #18651 -- Removed assignment_tag per deprecation timeline. --- tests/template_tests/templatetags/custom.py | 17 ----------------- tests/template_tests/test_custom.py | 23 ----------------------- 2 files changed, 40 deletions(-) (limited to 'tests') diff --git a/tests/template_tests/templatetags/custom.py b/tests/template_tests/templatetags/custom.py index fffef022ac..3c3e4ce8ed 100644 --- a/tests/template_tests/templatetags/custom.py +++ b/tests/template_tests/templatetags/custom.py @@ -1,5 +1,4 @@ import operator -import warnings from django import template from django.template.defaultfilters import stringfilter @@ -168,19 +167,3 @@ def minustwo_overridden_name(value): register.simple_tag(lambda x: x - 1, name='minusone') - - -with warnings.catch_warnings(): - warnings.simplefilter('ignore') - - @register.assignment_tag - def assignment_no_params(): - """Expected assignment_no_params __doc__""" - return "assignment_no_params - Expected result" - assignment_no_params.anything = "Expected assignment_no_params __dict__" - - @register.assignment_tag(takes_context=True) - def assignment_tag_without_context_parameter(arg): - """Expected assignment_tag_without_context_parameter __doc__""" - return "Expected result" - assignment_tag_without_context_parameter.anything = "Expected assignment_tag_without_context_parameter __dict__" diff --git a/tests/template_tests/test_custom.py b/tests/template_tests/test_custom.py index e6a876086e..b63882a9a8 100644 --- a/tests/template_tests/test_custom.py +++ b/tests/template_tests/test_custom.py @@ -306,29 +306,6 @@ class InclusionTagTests(TagTestCase): self.assertEqual(template.render(Context({})).strip(), 'one\ntwo') -class AssignmentTagTests(TagTestCase): - - def test_assignment_tags(self): - c = Context({'value': 42}) - - t = self.engine.from_string('{% load custom %}{% assignment_no_params as var %}The result is: {{ var }}') - self.assertEqual(t.render(c), 'The result is: assignment_no_params - Expected result') - - def test_assignment_tag_registration(self): - # The decorators preserve the decorated function's docstring, name, - # and attributes. - self.verify_tag(custom.assignment_no_params, 'assignment_no_params') - - def test_assignment_tag_missing_context(self): - # The 'context' parameter must be present when takes_context is True - msg = ( - "'assignment_tag_without_context_parameter' is decorated with " - "takes_context=True so it must have a first argument of 'context'" - ) - with self.assertRaisesMessage(TemplateSyntaxError, msg): - self.engine.from_string('{% load custom %}{% assignment_tag_without_context_parameter 123 as var %}') - - class TemplateTagLoadingTests(SimpleTestCase): @classmethod -- cgit v1.3