diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-31 18:17:21 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-31 18:17:21 +0000 |
| commit | a68c4a85ce4f80634aaaba37553db48ba3d3d8fd (patch) | |
| tree | 91b0c2ce63f9eaa6ecab5bcd9a1ed4019c7cc816 /tests/regressiontests | |
| parent | 83c6f8d4e2ac59fdfe37296e5c7494d19beba914 (diff) | |
Fixed #10513: floatformat now works with floatish things, not just real floats. Thanks, Alex.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10278 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests')
| -rw-r--r-- | tests/regressiontests/defaultfilters/tests.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py index a97596f4d7..027fcbba7d 100644 --- a/tests/regressiontests/defaultfilters/tests.py +++ b/tests/regressiontests/defaultfilters/tests.py @@ -35,8 +35,8 @@ u'8.280' u'' >>> floatformat(13.1031, u'bar') u'13.1031' ->>> floatformat(18.125, 2) -u'18.13' +>>> floatformat(18.125, 2) +u'18.13' >>> floatformat(u'foo', u'bar') u'' >>> floatformat(u'¿Cómo esta usted?') @@ -53,6 +53,15 @@ True >>> floatformat(nan) == unicode(nan) True +>>> class FloatWrapper(object): +... def __init__(self, value): +... self.value = value +... def __float__(self): +... return self.value + +>>> floatformat(FloatWrapper(11.000001), -2) +u'11.00' + >>> addslashes(u'"double quotes" and \'single quotes\'') u'\\"double quotes\\" and \\\'single quotes\\\'' @@ -180,23 +189,23 @@ u'<a href="http://31characteruri.com/test/" rel="nofollow">http://31characteruri u'<a href="http://31characteruri.com/test/" rel="nofollow">...</a>' # Check normal urlize ->>> urlize('http://google.com') +>>> urlize('http://google.com') u'<a href="http://google.com" rel="nofollow">http://google.com</a>' ->>> urlize('http://google.com/') +>>> urlize('http://google.com/') u'<a href="http://google.com/" rel="nofollow">http://google.com/</a>' ->>> urlize('www.google.com') +>>> urlize('www.google.com') u'<a href="http://www.google.com" rel="nofollow">www.google.com</a>' ->>> urlize('djangoproject.org') +>>> urlize('djangoproject.org') u'<a href="http://djangoproject.org" rel="nofollow">djangoproject.org</a>' ->>> urlize('info@djangoproject.org') +>>> urlize('info@djangoproject.org') u'<a href="mailto:info@djangoproject.org">info@djangoproject.org</a>' # Check urlize with https addresses ->>> urlize('https://google.com') +>>> urlize('https://google.com') u'<a href="https://google.com" rel="nofollow">https://google.com</a>' |
