From 34a71dc4e4c1f09da7fd47a566c4ae5965bc2f42 Mon Sep 17 00:00:00 2001 From: Chris Beaven Date: Mon, 25 Jul 2011 22:18:59 +0000 Subject: [PATCH] Add some simple regression tests for the truncatechars filter. Refs #16510. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16551 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/templates/filters.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/regressiontests/templates/filters.py b/tests/regressiontests/templates/filters.py index 9ada4fb26e..65f98e9ede 100644 --- a/tests/regressiontests/templates/filters.py +++ b/tests/regressiontests/templates/filters.py @@ -134,6 +134,9 @@ def get_filter_tests(): 'filter-truncatewords02': ('{{ a|truncatewords:"2" }} {{ b|truncatewords:"2"}}', {"a": "alpha & bravo", "b": mark_safe("alpha & bravo")}, u"alpha & ... alpha & ..."), + 'filter-truncatechars01': ('{{ a|truncatechars:5 }}', {'a': "Testing, testing"}, u"Te..."), + 'filter-truncatechars02': ('{{ a|truncatechars:7 }}', {'a': "Testing"}, u"Testing"), + # The "upper" filter messes up entities (which are case-sensitive), # so it's not safe for non-escaping purposes. 'filter-upper01': ('{% autoescape off %}{{ a|upper }} {{ b|upper }}{% endautoescape %}', {"a": "a & b", "b": mark_safe("a & b")}, u"A & B A & B"),