diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py
index cbd4776..08afd4d 100644
--- a/tests/regressiontests/defaultfilters/tests.py
+++ b/tests/regressiontests/defaultfilters/tests.py
@@ -9,35 +9,6 @@ from django.template.defaultfilters import *
 class DefaultFiltersTests(TestCase):
 
     def test_floatformat(self):
-        self.assertEqual(floatformat(7.7), u'7.7')
-        self.assertEqual(floatformat(7.0), u'7')
-        self.assertEqual(floatformat(0.7), u'0.7')
-        self.assertEqual(floatformat(0.07), u'0.1')
-        self.assertEqual(floatformat(0.007), u'0.0')
-        self.assertEqual(floatformat(0.0), u'0')
-        self.assertEqual(floatformat(7.7, 3), u'7.700')
-        self.assertEqual(floatformat(6.000000, 3), u'6.000')
-        self.assertEqual(floatformat(6.200000, 3), u'6.200')
-        self.assertEqual(floatformat(6.200000, -3), u'6.200')
-        self.assertEqual(floatformat(13.1031, -3), u'13.103')
-        self.assertEqual(floatformat(11.1197, -2), u'11.12')
-        self.assertEqual(floatformat(11.0000, -2), u'11')
-        self.assertEqual(floatformat(11.000001, -2), u'11.00')
-        self.assertEqual(floatformat(8.2798, 3), u'8.280')
-        self.assertEqual(floatformat(u'foo'), u'')
-        self.assertEqual(floatformat(13.1031, u'bar'), u'13.1031')
-        self.assertEqual(floatformat(18.125, 2), u'18.13')
-        self.assertEqual(floatformat(u'foo', u'bar'), u'')
-        self.assertEqual(floatformat(u'¿Cómo esta usted?'), u'')
-        self.assertEqual(floatformat(None), u'')
-
-        # Check that we're not converting to scientific notation.
-        self.assertEqual(floatformat(0, 6), u'0.000000')
-        self.assertEqual(floatformat(0, 7), u'0.0000000')
-        self.assertEqual(floatformat(0, 10), u'0.0000000000')
-        self.assertEqual(floatformat(0.000000000000000000015, 20),
-                                     u'0.00000000000000000002')
-
         pos_inf = float(1e30000)
         self.assertEqual(floatformat(pos_inf), unicode(pos_inf))
 
@@ -62,180 +33,6 @@ class DefaultFiltersTests(TestCase):
     def test_floatformat_fail(self):
         self.assertEqual(floatformat(1.00000000000000015, 16), u'1.0000000000000002')
 
-    def test_addslashes(self):
-        self.assertEqual(addslashes(u'"double quotes" and \'single quotes\''),
-                          u'\\"double quotes\\" and \\\'single quotes\\\'')
-
-        self.assertEqual(addslashes(ur'\ : backslashes, too'),
-                          u'\\\\ : backslashes, too')
-
-    def test_capfirst(self):
-        self.assertEqual(capfirst(u'hello world'), u'Hello world')
-
-    def test_escapejs(self):
-        self.assertEqual(escapejs(u'"double quotes" and \'single quotes\''),
-            u'\\u0022double quotes\\u0022 and \\u0027single quotes\\u0027')
-        self.assertEqual(escapejs(ur'\ : backslashes, too'),
-            u'\\u005C : backslashes, too')
-        self.assertEqual(escapejs(u'and lots of whitespace: \r\n\t\v\f\b'),
-            u'and lots of whitespace: \\u000D\\u000A\\u0009\\u000B\\u000C\\u0008')
-        self.assertEqual(escapejs(ur'<script>and this</script>'),
-            u'\\u003Cscript\\u003Eand this\\u003C/script\\u003E')
-        self.assertEqual(
-            escapejs(u'paragraph separator:\u2029and line separator:\u2028'),
-            u'paragraph separator:\\u2029and line separator:\\u2028')
-
-    def test_fix_ampersands(self):
-        self.assertEqual(fix_ampersands(u'Jack & Jill & Jeroboam'),
-                          u'Jack &amp; Jill &amp; Jeroboam')
-
-    def test_linenumbers(self):
-        self.assertEqual(linenumbers(u'line 1\nline 2'),
-                          u'1. line 1\n2. line 2')
-        self.assertEqual(linenumbers(u'\n'.join([u'x'] * 10)),
-                          u'01. x\n02. x\n03. x\n04. x\n05. x\n06. x\n07. '\
-                          u'x\n08. x\n09. x\n10. x')
-
-    def test_lower(self):
-        self.assertEqual(lower('TEST'), u'test')
-
-        # uppercase E umlaut
-        self.assertEqual(lower(u'\xcb'), u'\xeb')
-
-    def test_make_list(self):
-        self.assertEqual(make_list('abc'), [u'a', u'b', u'c'])
-        self.assertEqual(make_list(1234), [u'1', u'2', u'3', u'4'])
-
-    def test_slugify(self):
-        self.assertEqual(slugify(' Jack & Jill like numbers 1,2,3 and 4 and'\
-            ' silly characters ?%.$!/'),
-            u'jack-jill-like-numbers-123-and-4-and-silly-characters')
-
-        self.assertEqual(slugify(u"Un \xe9l\xe9phant \xe0 l'or\xe9e du bois"),
-                          u'un-elephant-a-loree-du-bois')
-
-    def test_stringformat(self):
-        self.assertEqual(stringformat(1, u'03d'), u'001')
-        self.assertEqual(stringformat(1, u'z'), u'')
-
-    def test_title(self):
-        self.assertEqual(title('a nice title, isn\'t it?'),
-                          u"A Nice Title, Isn't It?")
-        self.assertEqual(title(u'discoth\xe8que'), u'Discoth\xe8que')
-
-    def test_truncatewords(self):
-        self.assertEqual(
-            truncatewords(u'A sentence with a few words in it', 1), u'A ...')
-        self.assertEqual(
-            truncatewords(u'A sentence with a few words in it', 5),
-            u'A sentence with a few ...')
-        self.assertEqual(
-            truncatewords(u'A sentence with a few words in it', 100),
-            u'A sentence with a few words in it')
-        self.assertEqual(
-            truncatewords(u'A sentence with a few words in it',
-            'not a number'), u'A sentence with a few words in it')
-
-    def test_truncatewords_html(self):
-        self.assertEqual(truncatewords_html(
-            u'<p>one <a href="#">two - three <br>four</a> five</p>', 0), u'')
-        self.assertEqual(truncatewords_html(u'<p>one <a href="#">two - '\
-            u'three <br>four</a> five</p>', 2),
-            u'<p>one <a href="#">two ...</a></p>')
-        self.assertEqual(truncatewords_html(
-            u'<p>one <a href="#">two - three <br>four</a> five</p>', 4),
-            u'<p>one <a href="#">two - three <br>four ...</a></p>')
-        self.assertEqual(truncatewords_html(
-            u'<p>one <a href="#">two - three <br>four</a> five</p>', 5),
-            u'<p>one <a href="#">two - three <br>four</a> five</p>')
-        self.assertEqual(truncatewords_html(
-            u'<p>one <a href="#">two - three <br>four</a> five</p>', 100),
-            u'<p>one <a href="#">two - three <br>four</a> five</p>')
-        self.assertEqual(truncatewords_html(
-            u'\xc5ngstr\xf6m was here', 1), u'\xc5ngstr\xf6m ...')
-
-    def test_upper(self):
-        self.assertEqual(upper(u'Mixed case input'), u'MIXED CASE INPUT')
-        # lowercase e umlaut
-        self.assertEqual(upper(u'\xeb'), u'\xcb')
-
-    def test_urlencode(self):
-        self.assertEqual(urlencode(u'fran\xe7ois & jill'),
-                          u'fran%C3%A7ois%20%26%20jill')
-        self.assertEqual(urlencode(1), u'1')
-
-    def test_iriencode(self):
-        self.assertEqual(iriencode(u'S\xf8r-Tr\xf8ndelag'),
-                          u'S%C3%B8r-Tr%C3%B8ndelag')
-        self.assertEqual(iriencode(urlencode(u'fran\xe7ois & jill')),
-                          u'fran%C3%A7ois%20%26%20jill')
-
-    def test_urlizetrunc(self):
-        self.assertEqual(urlizetrunc(u'http://short.com/', 20), u'<a href='\
-            u'"http://short.com/" rel="nofollow">http://short.com/</a>')
-
-        self.assertEqual(urlizetrunc(u'http://www.google.co.uk/search?hl=en'\
-            u'&q=some+long+url&btnG=Search&meta=', 20), u'<a href="http://'\
-            u'www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&'\
-            u'meta=" rel="nofollow">http://www.google...</a>')
-
-        self.assertEqual(urlizetrunc('http://www.google.co.uk/search?hl=en'\
-            u'&q=some+long+url&btnG=Search&meta=', 20), u'<a href="http://'\
-            u'www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search'\
-            u'&meta=" rel="nofollow">http://www.google...</a>')
-
-        # Check truncating of URIs which are the exact length
-        uri = 'http://31characteruri.com/test/'
-        self.assertEqual(len(uri), 31)
-
-        self.assertEqual(urlizetrunc(uri, 31),
-            u'<a href="http://31characteruri.com/test/" rel="nofollow">'\
-            u'http://31characteruri.com/test/</a>')
-
-        self.assertEqual(urlizetrunc(uri, 30),
-            u'<a href="http://31characteruri.com/test/" rel="nofollow">'\
-            u'http://31characteruri.com/t...</a>')
-
-        self.assertEqual(urlizetrunc(uri, 2),
-            u'<a href="http://31characteruri.com/test/"'\
-            u' rel="nofollow">...</a>')
-
-    def test_urlize(self):
-        # Check normal urlize
-        self.assertEqual(urlize('http://google.com'),
-            u'<a href="http://google.com" rel="nofollow">http://google.com</a>')
-        self.assertEqual(urlize('http://google.com/'),
-            u'<a href="http://google.com/" rel="nofollow">http://google.com/</a>')
-        self.assertEqual(urlize('www.google.com'),
-            u'<a href="http://www.google.com" rel="nofollow">www.google.com</a>')
-        self.assertEqual(urlize('djangoproject.org'),
-            u'<a href="http://djangoproject.org" rel="nofollow">djangoproject.org</a>')
-        self.assertEqual(urlize('info@djangoproject.org'),
-            u'<a href="mailto:info@djangoproject.org">info@djangoproject.org</a>')
-
-        # Check urlize with https addresses
-        self.assertEqual(urlize('https://google.com'),
-            u'<a href="https://google.com" rel="nofollow">https://google.com</a>')
-
-    def test_wordcount(self):
-        self.assertEqual(wordcount(''), 0)
-        self.assertEqual(wordcount(u'oneword'), 1)
-        self.assertEqual(wordcount(u'lots of words'), 3)
-
-        self.assertEqual(wordwrap(u'this is a long paragraph of text that '\
-            u'really needs to be wrapped I\'m afraid', 14),
-            u"this is a long\nparagraph of\ntext that\nreally needs\nto be "\
-            u"wrapped\nI'm afraid")
-
-        self.assertEqual(wordwrap(u'this is a short paragraph of text.\n  '\
-            u'But this line should be indented', 14),
-            u'this is a\nshort\nparagraph of\ntext.\n  But this\nline '\
-            u'should be\nindented')
-
-        self.assertEqual(wordwrap(u'this is a short paragraph of text.\n  '\
-            u'But this line should be indented',15), u'this is a short\n'\
-            u'paragraph of\ntext.\n  But this line\nshould be\nindented')
-
     def test_rjust(self):
         self.assertEqual(ljust(u'test', 10), u'test      ')
         self.assertEqual(ljust(u'test', 3), u'test')
diff --git a/tests/regressiontests/templates/filters.py b/tests/regressiontests/templates/filters.py
index 65f98e9..caa5a44 100644
--- a/tests/regressiontests/templates/filters.py
+++ b/tests/regressiontests/templates/filters.py
@@ -86,25 +86,60 @@ def get_filter_tests():
 
         'filter-addslash01': ("{% autoescape off %}{{ a|addslashes }} {{ b|addslashes }}{% endautoescape %}", {"a": "<a>'", "b": mark_safe("<a>'")}, ur"<a>\' <a>\'"),
         'filter-addslash02': ("{{ a|addslashes }} {{ b|addslashes }}", {"a": "<a>'", "b": mark_safe("<a>'")}, ur"&lt;a&gt;\&#39; <a>\'"),
+        'filter-addslash03': ("{{ a|addslashes }}", {"a": mark_safe(u"\"double quotes\" and 'single quotes'")}, u"\\\"double quotes\\\" and \\'single quotes\\'"),
+        'filter-addslash04': ("{{ a|addslashes }}", {"a": mark_safe(ur"\ : backslashes, too")}, u"\\\\ : backslashes, too"),
 
         'filter-capfirst01': ("{% autoescape off %}{{ a|capfirst }} {{ b|capfirst }}{% endautoescape %}", {"a": "fred>", "b": mark_safe("fred&gt;")}, u"Fred> Fred&gt;"),
         'filter-capfirst02': ("{{ a|capfirst }} {{ b|capfirst }}", {"a": "fred>", "b": mark_safe("fred&gt;")}, u"Fred&gt; Fred&gt;"),
+        'filter-capfirst03': ("{{ a|capfirst }}", {"a": "hello world"}, u"Hello world"),
 
         # Note that applying fix_ampsersands in autoescape mode leads to
         # double escaping.
         'filter-fix_ampersands01': ("{% autoescape off %}{{ a|fix_ampersands }} {{ b|fix_ampersands }}{% endautoescape %}", {"a": "a&b", "b": mark_safe("a&b")}, u"a&amp;b a&amp;b"),
         'filter-fix_ampersands02': ("{{ a|fix_ampersands }} {{ b|fix_ampersands }}", {"a": "a&b", "b": mark_safe("a&b")}, u"a&amp;amp;b a&amp;b"),
+        'filter-fix_ampersands03': ("{{ a|fix_ampersands }}", {"a": mark_safe(u"Jack & Jill & Jeroboam")}, u"Jack &amp; Jill &amp; Jeroboam"),
 
         'filter-floatformat01': ("{% autoescape off %}{{ a|floatformat }} {{ b|floatformat }}{% endautoescape %}", {"a": "1.42", "b": mark_safe("1.42")}, u"1.4 1.4"),
         'filter-floatformat02': ("{{ a|floatformat }} {{ b|floatformat }}", {"a": "1.42", "b": mark_safe("1.42")}, u"1.4 1.4"),
+        'filter-floatformat03': ("{{ a|floatformat }}", {"a": 7.7}, u"7.7"),
+        'filter-floatformat04': ("{{ a|floatformat }}", {"a": 7.0}, u"7"),
+        'filter-floatformat05': ("{{ a|floatformat }}", {"a": 0.7}, u"0.7"),
+        'filter-floatformat06': ("{{ a|floatformat }}", {"a": 0.07}, u"0.1"),
+        'filter-floatformat07': ("{{ a|floatformat }}", {"a": 0.007}, u"0.0"),
+        'filter-floatformat08': ("{{ a|floatformat }}", {"a": 0.0}, u"0"),
+        'filter-floatformat09': ("{{ a|floatformat:b }}", {"a": 7.7, "b": "3"}, u"7.700"),
+        'filter-floatformat10': ("{{ a|floatformat:b }}", {"a": 6.000000, "b": 3}, u"6.000"),
+        'filter-floatformat11': ("{{ a|floatformat:b }}", {"a": 6.200000, "b": 3}, u"6.200"),
+        'filter-floatformat12': ("{{ a|floatformat:b }}", {"a": 6.200000, "b": -3}, u"6.200"),
+        'filter-floatformat13': ("{{ a|floatformat:b }}", {"a": 13.1031, "b": -3}, u"13.103"),
+        'filter-floatformat14': ("{{ a|floatformat:b }}", {"a": 11.1197, "b": -2}, u"11.12"),
+        'filter-floatformat15': ("{{ a|floatformat:b }}", {"a": 11.0000, "b": -2}, u"11"),
+        'filter-floatformat16': ("{{ a|floatformat:b }}", {"a": 11.000001, "b": -2}, u"11.00"),
+        'filter-floatformat17': ("{{ a|floatformat:b }}", {"a": 8.2798, "b": 3}, u"8.280"),
+        'filter-floatformat18': ("{{ a|floatformat }}", {"a": "foo"}, u""),
+        'filter-floatformat19': ("{{ a|floatformat:b }}", {"a": 13.1031, "b": "bar"}, u"13.1031"),
+        'filter-floatformat20': ("{{ a|floatformat:b }}", {"a": 18.125, "b": 2}, u"18.13"),
+        'filter-floatformat21': ("{{ a|floatformat:b }}", {"a": "foo", "b": "bar"}, u""),
+        'filter-floatformat22': ("{{ a|floatformat }}", {"a": "¿Cómo esta usted?"}, u""),
+        'filter-floatformat23': ("{{ a|floatformat }}", {"a": None}, u""),
+
+        # Check that we're not converting to scientific notation.
+        'filter-floatformat24': ("{{ a|floatformat:b }}", {"a": 0, "b": 6}, u"0.000000"),
+        'filter-floatformat25': ("{{ a|floatformat:b }}", {"a": 0, "b": 7}, u"0.0000000"),
+        'filter-floatformat26': ("{{ a|floatformat:b }}", {"a": 0, "b": 10}, u"0.0000000000"),
+        'filter-floatformat27': ("{{ a|floatformat:b }}", {"a": 0.000000000000000000015, "b": 20}, u"0.00000000000000000002"),
 
         # The contents of "linenumbers" is escaped according to the current
         # autoescape setting.
         'filter-linenumbers01': ("{{ a|linenumbers }} {{ b|linenumbers }}", {"a": "one\n<two>\nthree", "b": mark_safe("one\n&lt;two&gt;\nthree")}, u"1. one\n2. &lt;two&gt;\n3. three 1. one\n2. &lt;two&gt;\n3. three"),
         'filter-linenumbers02': ("{% autoescape off %}{{ a|linenumbers }} {{ b|linenumbers }}{% endautoescape %}", {"a": "one\n<two>\nthree", "b": mark_safe("one\n&lt;two&gt;\nthree")}, u"1. one\n2. <two>\n3. three 1. one\n2. &lt;two&gt;\n3. three"),
+        'filter-linenumbers03': ("{{ a|linenumbers }}", {"a": "line 1\nline 2"}, u"1. line 1\n2. line 2"),
+        'filter-linenumbers04': ("{{ a|linenumbers }}", {"a": "\n".join([u'x'] * 10)}, u"01. x\n02. x\n03. x\n04. x\n05. x\n06. x\n07. x\n08. x\n09. x\n10. x"),
 
         'filter-lower01': ("{% autoescape off %}{{ a|lower }} {{ b|lower }}{% endautoescape %}", {"a": "Apple & banana", "b": mark_safe("Apple &amp; banana")}, u"apple & banana apple &amp; banana"),
         'filter-lower02': ("{{ a|lower }} {{ b|lower }}", {"a": "Apple & banana", "b": mark_safe("Apple &amp; banana")}, u"apple &amp; banana apple &amp; banana"),
+        'filter-lower03': ("{{ a|lower }}", {"a": "TEST"}, u"test"),
+        'filter-lower04': ("{{ a|lower }}", {"a": u"\xcb"}, u"\xeb"), # uppercase E umlaut
 
         # The make_list filter can destroy existing escaping, so the results are
         # escaped.
@@ -112,11 +147,15 @@ def get_filter_tests():
         'filter-make_list02': ("{{ a|make_list }}", {"a": mark_safe("&")}, u"[u&#39;&amp;&#39;]"),
         'filter-make_list03': ('{% autoescape off %}{{ a|make_list|stringformat:"s"|safe }}{% endautoescape %}', {"a": mark_safe("&")}, u"[u'&']"),
         'filter-make_list04': ('{{ a|make_list|stringformat:"s"|safe }}', {"a": mark_safe("&")}, u"[u'&']"),
+        'filter-make_list05': ('{% autoescape off %}{{ a|make_list }}{% endautoescape %}', {"a": 'abc'}, u"[u'a', u'b', u'c']"),
+        'filter-make_list06': ('{% autoescape off %}{{ a|make_list }}{% endautoescape %}', {"a": 1234}, u"[u'1', u'2', u'3', u'4']"),
 
         # Running slugify on a pre-escaped string leads to odd behaviour,
         # but the result is still safe.
         'filter-slugify01': ("{% autoescape off %}{{ a|slugify }} {{ b|slugify }}{% endautoescape %}", {"a": "a & b", "b": mark_safe("a &amp; b")}, u"a-b a-amp-b"),
         'filter-slugify02': ("{{ a|slugify }} {{ b|slugify }}", {"a": "a & b", "b": mark_safe("a &amp; b")}, u"a-b a-amp-b"),
+        'filter-slugify03': ("{{ a|slugify }}", {"a": " Jack & Jill like numbers 1,2,3 and 4 and silly characters ?%.$!/"}, u"jack-jill-like-numbers-123-and-4-and-silly-characters"),
+        'filter-slugify04': ("{{ a|slugify }}", {"a": u"Un \xe9l\xe9phant \xe0 l'or\xe9e du bois"}, u"un-elephant-a-loree-du-bois"),
 
         # Notice that escaping is applied *after* any filters, so the string
         # formatting here only needs to deal with pre-escaped characters.
@@ -124,15 +163,34 @@ def get_filter_tests():
             {"a": "a<b", "b": mark_safe("a<b")}, u".  a<b. .  a<b."),
         'filter-stringformat02': ('.{{ a|stringformat:"5s" }}. .{{ b|stringformat:"5s" }}.', {"a": "a<b", "b": mark_safe("a<b")},
             u".  a&lt;b. .  a<b."),
+        'filter-stringformat03': ('{{ a|stringformat:"03d" }}', {'a': 1}, u'001'),
+        'filter-stringformat04': ('{{ a|stringformat:"z" }}', {'a': 1}, u''),
 
         # Test the title filter
-        'filter-title1' : ('{{ a|title }}', {'a' : 'JOE\'S CRAB SHACK'}, u'Joe&#39;s Crab Shack'),
-        'filter-title2' : ('{{ a|title }}', {'a' : '555 WEST 53RD STREET'}, u'555 West 53rd Street'),
+        'filter-title01' : ('{{ a|title }}', {'a' : 'JOE\'S CRAB SHACK'}, u'Joe&#39;s Crab Shack'),
+        'filter-title02' : ('{{ a|title }}', {'a' : '555 WEST 53RD STREET'}, u'555 West 53rd Street'),
+        'filter-title03' : ('{% autoescape off %}{{ a|title }}{% endautoescape %}', {'a' : 'a nice title, isn\'t it?'}, u'A Nice Title, Isn\'t It?'),
+        'filter-title04' : ('{{ a|title }}', {'a' : u'discoth\xe8que'}, u'Discoth\xe8que'),
 
         'filter-truncatewords01': ('{% autoescape off %}{{ a|truncatewords:"2" }} {{ b|truncatewords:"2"}}{% endautoescape %}',
             {"a": "alpha & bravo", "b": mark_safe("alpha &amp; bravo")}, u"alpha & ... alpha &amp; ..."),
         'filter-truncatewords02': ('{{ a|truncatewords:"2" }} {{ b|truncatewords:"2"}}',
             {"a": "alpha & bravo", "b": mark_safe("alpha &amp; bravo")}, u"alpha &amp; ... alpha &amp; ..."),
+        'filter-truncatewords03': ('{{ a|truncatewords:b }}',
+            {"a": "A sentence with a few words in it", "b": 1}, u"A ..."),
+        'filter-truncatewords04': ('{{ a|truncatewords:b }}',
+            {"a": "A sentence with a few words in it", "b": 5}, u"A sentence with a few ..."),
+        'filter-truncatewords05': ('{{ a|truncatewords:b }}',
+            {"a": "A sentence with a few words in it", "b": 100}, u"A sentence with a few words in it"),
+        'filter-truncatewords06': ('{{ a|truncatewords:b }}',
+            {"a": "A sentence with a few words in it", "b": "not a number"}, u"A sentence with a few words in it"),
+
+        'filter-truncatewords_html01': ('{{ a|truncatewords_html:b }}', {'a': mark_safe('<p>one <a href="#">two - three <br>four</a> five</p>'), 'b': 0}, u''),
+        'filter-truncatewords_html02': ('{{ a|truncatewords_html:b }}', {'a': mark_safe('<p>one <a href="#">two - three <br>four</a> five</p>'), 'b': 2}, u'<p>one <a href="#">two ...</a></p>'),
+        'filter-truncatewords_html03': ('{{ a|truncatewords_html:b }}', {'a': mark_safe('<p>one <a href="#">two - three <br>four</a> five</p>'), 'b': 4}, u'<p>one <a href="#">two - three <br>four ...</a></p>'),
+        'filter-truncatewords_html04': ('{{ a|truncatewords_html:b }}', {'a': mark_safe('<p>one <a href="#">two - three <br>four</a> five</p>'), 'b': 5}, u'<p>one <a href="#">two - three <br>four</a> five</p>'),
+        'filter-truncatewords_html05': ('{{ a|truncatewords_html:b }}', {'a': mark_safe('<p>one <a href="#">two - three <br>four</a> five</p>'), 'b': 100}, u'<p>one <a href="#">two - three <br>four</a> five</p>'),
+        'filter-truncatewords_html06': ('{{ a|truncatewords_html:b }}', {'a': u'\xc5ngstr\xf6m was here', 'b': 1}, u'\xc5ngstr\xf6m ...'),
 
         'filter-truncatechars01': ('{{ a|truncatechars:5 }}', {'a': "Testing, testing"}, u"Te..."),
         'filter-truncatechars02': ('{{ a|truncatechars:7 }}', {'a': "Testing"}, u"Testing"),
@@ -141,6 +199,8 @@ def get_filter_tests():
         # 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 &amp; b")}, u"A & B A &AMP; B"),
         'filter-upper02': ('{{ a|upper }} {{ b|upper }}', {"a": "a & b", "b": mark_safe("a &amp; b")}, u"A &amp; B A &amp;AMP; B"),
+        'filter-upper03': ('{{ a|upper }}', {"a": "Mixed case input"}, u"MIXED CASE INPUT"),
+        'filter-upper04': ('{{ a|upper }}', {"a": u"\xeb"}, u"\xcb"),
 
         'filter-urlize01': ('{% autoescape off %}{{ a|urlize }} {{ b|urlize }}{% endautoescape %}', {"a": "http://example.com/?x=&y=", "b": mark_safe("http://example.com?x=&amp;y=")}, u'<a href="http://example.com/?x=&y=" rel="nofollow">http://example.com/?x=&y=</a> <a href="http://example.com?x=&amp;y=" rel="nofollow">http://example.com?x=&amp;y=</a>'),
         'filter-urlize02': ('{{ a|urlize }} {{ b|urlize }}', {"a": "http://example.com/?x=&y=", "b": mark_safe("http://example.com?x=&amp;y=")}, u'<a href="http://example.com/?x=&amp;y=" rel="nofollow">http://example.com/?x=&amp;y=</a> <a href="http://example.com?x=&amp;y=" rel="nofollow">http://example.com?x=&amp;y=</a>'),
@@ -156,14 +216,37 @@ def get_filter_tests():
         'filter-urlize07': ('{{ a|urlize }}', {"a": "Email me at me@example.com"}, 'Email me at <a href="mailto:me@example.com">me@example.com</a>'),
         'filter-urlize08': ('{{ a|urlize }}', {"a": "Email me at <me@example.com>"}, 'Email me at &lt;<a href="mailto:me@example.com">me@example.com</a>&gt;'),
 
+        'filter-urlize09': ('{{ a|urlize }}', {'a': 'http://google.com'}, u'<a href="http://google.com" rel="nofollow">http://google.com</a>'),
+        'filter-urlize10': ('{{ a|urlize }}', {'a': 'http://google.com/'}, u'<a href="http://google.com/" rel="nofollow">http://google.com/</a>'),
+        'filter-urlize11': ('{{ a|urlize }}', {'a': 'www.google.com'}, u'<a href="http://www.google.com" rel="nofollow">www.google.com</a>'),
+        'filter-urlize12': ('{{ a|urlize }}', {'a': 'djangoproject.org'}, u'<a href="http://djangoproject.org" rel="nofollow">djangoproject.org</a>'),
+        'filter-urlize13': ('{{ a|urlize }}', {'a': 'info@djangoproject.org'}, u'<a href="mailto:info@djangoproject.org">info@djangoproject.org</a>'),
+
+        # Check urlize with https addresses
+        'filter-urlize10': ('{{ a|urlize }}', {'a': 'https://google.com'}, u'<a href="https://google.com" rel="nofollow">https://google.com</a>'),
+
+
         'filter-urlizetrunc01': ('{% autoescape off %}{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}{% endautoescape %}', {"a": '"Unsafe" http://example.com/x=&y=', "b": mark_safe('&quot;Safe&quot; http://example.com?x=&amp;y=')}, u'"Unsafe" <a href="http://example.com/x=&y=" rel="nofollow">http:...</a> &quot;Safe&quot; <a href="http://example.com?x=&amp;y=" rel="nofollow">http:...</a>'),
         'filter-urlizetrunc02': ('{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}', {"a": '"Unsafe" http://example.com/x=&y=', "b": mark_safe('&quot;Safe&quot; http://example.com?x=&amp;y=')}, u'&quot;Unsafe&quot; <a href="http://example.com/x=&amp;y=" rel="nofollow">http:...</a> &quot;Safe&quot; <a href="http://example.com?x=&amp;y=" rel="nofollow">http:...</a>'),
+        'filter-urlizetrunc03': ('{% autoescape off %}{{ a|urlizetrunc:b }}{% endautoescape %}', {'a': 'http://short.com/', 'b': 20}, u'<a href="http://short.com/" rel="nofollow">http://short.com/</a>'),
+        'filter-urlizetrunc04': ('{% autoescape off %}{{ a|urlizetrunc:b }}{% endautoescape %}', {'a': 'http://www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&meta=', 'b': 20}, u'<a href="http://www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&meta=" rel="nofollow">http://www.google...</a>'),
+        'filter-urlizetrunc05': ('{% autoescape off %}{{ a|urlizetrunc:b }}{% endautoescape %}', {'a': 'http://www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&meta=', 'b': 20}, u'<a href="http://www.google.co.uk/search?hl=en&q=some+long+url&btnG=Search&meta=" rel="nofollow">http://www.google...</a>'),
+        # Check truncating of URIs which are the exact length
+        'filter-urlizetrunc06': ('{% autoescape off %}{{ a|urlizetrunc:b }}{% endautoescape %}', {'a': 'http://31characteruri.com/test/', 'b': 31}, u'<a href="http://31characteruri.com/test/" rel="nofollow">http://31characteruri.com/test/</a>'),
+        'filter-urlizetrunc07': ('{% autoescape off %}{{ a|urlizetrunc:b }}{% endautoescape %}', {'a': 'http://31characteruri.com/test/', 'b': 30}, u'<a href="http://31characteruri.com/test/" rel="nofollow">http://31characteruri.com/t...</a>'),
+        'filter-urlizetrunc08': ('{% autoescape off %}{{ a|urlizetrunc:b }}{% endautoescape %}', {'a': 'http://31characteruri.com/test/', 'b': 2}, u'<a href="http://31characteruri.com/test/" rel="nofollow">...</a>'),
 
         'filter-wordcount01': ('{% autoescape off %}{{ a|wordcount }} {{ b|wordcount }}{% endautoescape %}', {"a": "a & b", "b": mark_safe("a &amp; b")}, "3 3"),
         'filter-wordcount02': ('{{ a|wordcount }} {{ b|wordcount }}', {"a": "a & b", "b": mark_safe("a &amp; b")}, "3 3"),
+        'filter-wordcount03': ('{{ a|wordcount }}', {"a": ""}, u"0"),
+        'filter-wordcount04': ('{{ a|wordcount }}', {"a": "oneword"}, u"1"),
+        'filter-wordcount05': ('{{ a|wordcount }}', {"a": "lots of words"}, u"3"),
 
         'filter-wordwrap01': ('{% autoescape off %}{{ a|wordwrap:"3" }} {{ b|wordwrap:"3" }}{% endautoescape %}', {"a": "a & b", "b": mark_safe("a & b")}, u"a &\nb a &\nb"),
         'filter-wordwrap02': ('{{ a|wordwrap:"3" }} {{ b|wordwrap:"3" }}', {"a": "a & b", "b": mark_safe("a & b")}, u"a &amp;\nb a &\nb"),
+        'filter-wordwrap03': ('{{ a|wordwrap:b }}', {"a": mark_safe("this is a long paragraph of text that really needs to be wrapped I\'m afraid"), "b": 14}, u"this is a long\nparagraph of\ntext that\nreally needs\nto be wrapped\nI'm afraid"),
+        'filter-wordwrap04': ('{{ a|wordwrap:b }}', {"a": "this is a short paragraph of text.\n  But this line should be indented", "b": 14}, u"this is a\nshort\nparagraph of\ntext.\n  But this\nline should be\nindented"),
+        'filter-wordwrap05': ('{{ a|wordwrap:b }}', {"a": "this is a short paragraph of text.\n  But this line should be indented", "b": 15}, u"this is a short\nparagraph of\ntext.\n  But this line\nshould be\nindented"),
 
         'filter-ljust01': ('{% autoescape off %}.{{ a|ljust:"5" }}. .{{ b|ljust:"5" }}.{% endautoescape %}', {"a": "a&b", "b": mark_safe("a&b")}, u".a&b  . .a&b  ."),
         'filter-ljust02': ('.{{ a|ljust:"5" }}. .{{ b|ljust:"5" }}.', {"a": "a&b", "b": mark_safe("a&b")}, u".a&amp;b  . .a&b  ."),
@@ -267,10 +350,14 @@ def get_filter_tests():
         'filter-iriencode02': ('{% autoescape off %}{{ url|iriencode }}{% endautoescape %}', {'url': '?test=1&me=2'}, '?test=1&me=2'),
         'filter-iriencode03': ('{{ url|iriencode }}', {'url': mark_safe('?test=1&me=2')}, '?test=1&me=2'),
         'filter-iriencode04': ('{% autoescape off %}{{ url|iriencode }}{% endautoescape %}', {'url': mark_safe('?test=1&me=2')}, '?test=1&me=2'),
+        'filter-iriencode05': ('{{ a|iriencode }}', {'a': u'S\xf8r-Tr\xf8ndelag'}, u'S%C3%B8r-Tr%C3%B8ndelag'),
+        'filter-iriencode06': ('{{ a|urlencode|iriencode }}', {'a': u'fran\xe7ois & jill'}, u'fran%C3%A7ois%20%26%20jill'),
 
         # urlencode
         'filter-urlencode01': ('{{ url|urlencode }}', {'url': '/test&"/me?/'}, '/test%26%22/me%3F/'),
         'filter-urlencode02': ('/test/{{ urlbit|urlencode:"" }}/', {'urlbit': 'escape/slash'}, '/test/escape%2Fslash/'),
+        'filter-urlencode03': ('{{ a|urlencode }}', {'a': u'fran\xe7ois & jill'}, u'fran%C3%A7ois%20%26%20jill'),
+        'filter-urlencode04': ('{{ a|urlencode }}', {'a': 1}, u'1'),
 
         # Chaining a bunch of safeness-preserving filters should not alter
         # the safe status either way.
@@ -302,9 +389,13 @@ def get_filter_tests():
         'autoescape-stringfilter03': (r'{{ safe|capfirst }}', {'safe': SafeClass()}, 'You &gt; me'),
         'autoescape-stringfilter04': (r'{% autoescape off %}{{ safe|capfirst }}{% endautoescape %}', {'safe': SafeClass()}, 'You &gt; me'),
 
-        'escapejs01': (r'{{ a|escapejs }}', {'a': 'testing\r\njavascript \'string" <b>escaping</b>'}, 'testing\\u000D\\u000Ajavascript \\u0027string\\u0022 \\u003Cb\\u003Eescaping\\u003C/b\\u003E'),
-        'escapejs02': (r'{% autoescape off %}{{ a|escapejs }}{% endautoescape %}', {'a': 'testing\r\njavascript \'string" <b>escaping</b>'}, 'testing\\u000D\\u000Ajavascript \\u0027string\\u0022 \\u003Cb\\u003Eescaping\\u003C/b\\u003E'),
-
+        'escapejs01': ('{{ a|escapejs }}', {'a': u'testing\r\njavascript \'string" <b>escaping</b>'}, u'testing\\u000D\\u000Ajavascript \\u0027string\\u0022 \\u003Cb\\u003Eescaping\\u003C/b\\u003E'),
+        'escapejs02': ('{% autoescape off %}{{ a|escapejs }}{% endautoescape %}', {'a': u'testing\r\njavascript \'string" <b>escaping</b>'}, u'testing\\u000D\\u000Ajavascript \\u0027string\\u0022 \\u003Cb\\u003Eescaping\\u003C/b\\u003E'),
+        'escapejs03': ('{{ a|escapejs }}', {'a': u'"double quotes" and \'single quotes\''}, u'\\u0022double quotes\\u0022 and \\u0027single quotes\\u0027'),
+        'escapejs04': ('{{ a|escapejs }}', {'a': ur'\ : backslashes, too'}, u'\\u005C : backslashes, too'),
+        'escapejs05': ('{{ a|escapejs }}', {'a': u'and lots of whitespace: \r\n\t\v\f\b'}, u'and lots of whitespace: \\u000D\\u000A\\u0009\\u000B\\u000C\\u0008'),
+        'escapejs06': ('{{ a|escapejs }}', {'a': ur'<script>and this</script>'}, u'\\u003Cscript\\u003Eand this\\u003C/script\\u003E'),
+        'escapejs07': ('{{ a|escapejs }}', {'a': u'paragraph separator:\u2029and line separator:\u2028'}, u'paragraph separator:\\u2029and line separator:\\u2028'),
 
         # length filter.
         'length01': ('{{ list|length }}', {'list': ['4', None, True, {}]}, '4'),
@@ -336,11 +427,11 @@ def get_filter_tests():
         'join04': (r'{% autoescape off %}{{ a|join:" &amp; " }}{% endautoescape %}', {'a': ['alpha', 'beta & me']}, 'alpha &amp; beta & me'),
 
         # Test that joining with unsafe joiners don't result in unsafe strings (#11377)
-        'join05': (r'{{ a|join:var }}', {'a': ['alpha', 'beta & me'], 'var': ' & '}, 'alpha &amp; beta &amp; me'), 
-        'join06': (r'{{ a|join:var }}', {'a': ['alpha', 'beta & me'], 'var': mark_safe(' & ')}, 'alpha & beta &amp; me'), 
-        'join07': (r'{{ a|join:var|lower }}', {'a': ['Alpha', 'Beta & me'], 'var': ' & ' }, 'alpha &amp; beta &amp; me'), 
-        'join08': (r'{{ a|join:var|lower }}', {'a': ['Alpha', 'Beta & me'], 'var': mark_safe(' & ')}, 'alpha & beta &amp; me'), 
-        
+        'join05': (r'{{ a|join:var }}', {'a': ['alpha', 'beta & me'], 'var': ' & '}, 'alpha &amp; beta &amp; me'),
+        'join06': (r'{{ a|join:var }}', {'a': ['alpha', 'beta & me'], 'var': mark_safe(' & ')}, 'alpha & beta &amp; me'),
+        'join07': (r'{{ a|join:var|lower }}', {'a': ['Alpha', 'Beta & me'], 'var': ' & ' }, 'alpha &amp; beta &amp; me'),
+        'join08': (r'{{ a|join:var|lower }}', {'a': ['Alpha', 'Beta & me'], 'var': mark_safe(' & ')}, 'alpha & beta &amp; me'),
+
         'date01': (r'{{ d|date:"m" }}', {'d': datetime(2008, 1, 1)}, '01'),
         'date02': (r'{{ d|date }}', {'d': datetime(2008, 1, 1)}, 'Jan. 1, 2008'),
         #Ticket 9520: Make sure |date doesn't blow up on non-dates
