diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2007-02-23 18:02:51 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2007-02-23 18:02:51 +0000 |
| commit | 36512d5d734feee53b7787dbdf2d671f158ebaae (patch) | |
| tree | 930fe77de1c9d5b5bc84ec1c1bf4ff6dd89bb489 /tests/regressiontests | |
| parent | 1266766da4a30460a92659c270fea0904ce43c51 (diff) | |
Fixed #343: filters that take strings now handle non-strings correctly. Thanks to Boffbowsh for the original patch, and to SmileyChris for the updated patch and tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4558 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/defaultfilters/tests.py | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py index b4ec9a0b03..c850806052 100644 --- a/tests/regressiontests/defaultfilters/tests.py +++ b/tests/regressiontests/defaultfilters/tests.py @@ -388,7 +388,53 @@ False >>> phone2numeric('0800 flowers') '0800 3569377' - +# Filters shouldn't break if passed non-strings +>>> addslashes(123) +'123' +>>> linenumbers(123) +'1. 123' +>>> lower(123) +'123' +>>> make_list(123) +['1', '2', '3'] +>>> slugify(123) +'123' +>>> title(123) +'123' +>>> truncatewords(123, 2) +'123' +>>> upper(123) +'123' +>>> urlencode(123) +'123' +>>> urlize(123) +'123' +>>> urlizetrunc(123, 1) +'123' +>>> wordcount(123) +1 +>>> wordwrap(123, 2) +'123' +>>> ljust('123', 4) +'123 ' +>>> rjust('123', 4) +' 123' +>>> center('123', 5) +' 123 ' +>>> center('123', 6) +' 123 ' +>>> cut(123, '2') +'13' +>>> escape(123) +'123' +>>> linebreaks(123) +'<p>123</p>' +>>> linebreaksbr(123) +'123' +>>> removetags(123, 'a') +'123' +>>> striptags(123) +'123' """ |
