diff options
| author | Jannis Leidel <jannis@leidel.info> | 2010-12-21 15:07:43 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2010-12-21 15:07:43 +0000 |
| commit | 3cf8502d35cdfbb4f868a848b1f38dcc275f6be1 (patch) | |
| tree | 8639f2d8136ed3d52abb7bf7ff0393ee1b2d0ff8 /tests | |
| parent | 75f16982d839be682b4f54d9f179caa4a86c07a5 (diff) | |
Fixed #4976 -- Stopped humanize template tags to raise a TypeError if passed a value of ``None``. Thanks, Simon G. and Adam Vandenberg.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15000 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/humanize/tests.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/regressiontests/humanize/tests.py b/tests/regressiontests/humanize/tests.py index e1962ab442..7eeaaee594 100644 --- a/tests/regressiontests/humanize/tests.py +++ b/tests/regressiontests/humanize/tests.py @@ -32,24 +32,29 @@ class HumanizeTests(unittest.TestCase): def test_intcomma(self): test_list = (100, 1000, 10123, 10311, 1000000, 1234567.25, - '100', '1000', '10123', '10311', '1000000', '1234567.1234567') + '100', '1000', '10123', '10311', '1000000', '1234567.1234567', + None) result_list = ('100', '1,000', '10,123', '10,311', '1,000,000', '1,234,567.25', - '100', '1,000', '10,123', '10,311', '1,000,000', '1,234,567.1234567') + '100', '1,000', '10,123', '10,311', '1,000,000', '1,234,567.1234567', + None) self.humanize_tester(test_list, result_list, 'intcomma') def test_intword(self): test_list = ('100', '1000000', '1200000', '1290000', - '1000000000','2000000000','6000000000000') + '1000000000','2000000000','6000000000000', + None) result_list = ('100', '1.0 million', '1.2 million', '1.3 million', - '1.0 billion', '2.0 billion', '6.0 trillion') + '1.0 billion', '2.0 billion', '6.0 trillion', + None) self.humanize_tester(test_list, result_list, 'intword') def test_apnumber(self): test_list = [str(x) for x in range(1, 11)] + test_list.append(None) result_list = (u'one', u'two', u'three', u'four', u'five', u'six', - u'seven', u'eight', u'nine', u'10') + u'seven', u'eight', u'nine', u'10', None) self.humanize_tester(test_list, result_list, 'apnumber') @@ -61,10 +66,10 @@ class HumanizeTests(unittest.TestCase): someday = today - timedelta(days=10) notdate = u"I'm not a date value" - test_list = (today, yesterday, tomorrow, someday, notdate) + test_list = (today, yesterday, tomorrow, someday, notdate, None) someday_result = defaultfilters.date(someday) result_list = (_(u'today'), _(u'yesterday'), _(u'tomorrow'), - someday_result, u"I'm not a date value") + someday_result, u"I'm not a date value", None) self.humanize_tester(test_list, result_list, 'naturalday') if __name__ == '__main__': |
