Opened 12 years ago
Closed 12 years ago
#20059 closed Bug (fixed)
Test failure in humanize app for some languages
Reported by: | Owned by: | matiasb | |
---|---|---|---|
Component: | contrib.humanize | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
The tests of humanize app failed for LANGUAGE_CODE = 'ja-jp'
.
The problem was also reproduced for other LANGUAGE_CODEs such as 'fr-fr'
, 'de-de'
.
When the LANGUAGE_CODE was default value, 'en-us'
, the tests succeeded.
How to reproduce
- Create a new project.
$ pip install django==1.5 $ django-admin.py startproject sample
- Edit the sample/sample/settings.py like below:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Use sqlite3 'NAME': ':memory:', …… } } #LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'ja-jp' # Change to Japanese INSTALLED_APPS = ( …… 'django.contrib.humanize', # Add humanize app )
- Run the tests and see the failure.
$ python sample/manage.py test humanize Creating test database for alias 'default'… F..F.FF..FFF ====================================================================== FAIL: test_apnumber (django.contrib.humanize.tests.HumanizeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 121, in test_apnumber self.humanize_tester(test_list, result_list, 'apnumber') File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 47, in humanize_tester msg="%s test failed, produced '%s', should've produced '%s'" % (method, rendered, result)) AssertionError: apnumber test failed, produced '1', should've produced 'one' ====================================================================== FAIL: test_intcomma (django.contrib.humanize.tests.HumanizeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 67, in test_intcomma self.humanize_tester(test_list, result_list, 'intcomma') File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 47, in humanize_tester msg="%s test failed, produced '%s', should've produced '%s'" % (method, rendered, result)) AssertionError: intcomma test failed, produced '1000', should've produced '1,000' ====================================================================== FAIL: test_intword (django.contrib.humanize.tests.HumanizeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 95, in test_intword self.humanize_tester(test_list, result_list, 'intword') File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 47, in humanize_tester msg="%s test failed, produced '%s', should've produced '%s'" % (method, rendered, result)) AssertionError: intword test failed, produced '1.0\u767e\u4e07', should've produced '1.0 million' ====================================================================== FAIL: test_l10n_intcomma (django.contrib.humanize.tests.HumanizeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 78, in test_l10n_intcomma self.humanize_tester(test_list, result_list, 'intcomma') File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 47, in humanize_tester msg="%s test failed, produced '%s', should've produced '%s'" % (method, rendered, result)) AssertionError: intcomma test failed, produced '1000', should've produced '1,000' ====================================================================== FAIL: test_naturalday_uses_localtime (django.contrib.humanize.tests.HumanizeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 161, in test_naturalday_uses_localtime self.humanize_tester([dt], ['yesterday'], 'natural day' File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 47, in humanize_tester msg="%s test failed, produced '%s', should've produced '%s'" % (method, rendered, result)) AssertionError: naturalday test failed, produced '\u6628\u65e5', should've produced 'yesterday' ====================================================================== FAIL: test_naturaltime (django.contrib.humanize.tests.HumanizeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 222, in test_naturaltime self.humanize_tester(test_list, result_list, 'natural time' File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 47, in humanize_tester msg="%s test failed, produced '%s', should've produced '%s'" % (method, rendered, result)) AssertionError: naturaltime test failed, produced '\u4eca', should've produced 'now' ====================================================================== FAIL: test_ordinal (django.contrib.humanize.tests.HumanizeTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 57, in test_ordinal self.humanize_tester(test_list, result_list, 'ordinal') File "/Users/****/humanize-bug-reproduction-1.5/venv/lib/python2.7/site-packages/django/contrib/humanize/tests.py", line 47, in humanize_tester msg="%s test failed, produced '%s', should've produced '%s'" % (method, rendered, result)) AssertionError: ordinal test failed, produced '1\u756a\u76ee', should've produced '1st' ---------------------------------------------------------------------- Ran 12 tests in 0.060s FAILED (failures=7) Destroying test database for alias 'default'…))
Other information
- Python 2.7, Mac OSX.
- The problem was also reproduced on master (0122a98dad6a7785def47466814ed2ae8d244143).
- The problem was also reproduced on Django 1.4.2, but it seems somewhat strange. On 1.4.2,
python manage.py test humanize
failed too, butpython manage.py test
succeeded.
Change History (4)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 12 years ago
Has patch: | set |
---|
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Created pull request: https://github.com/django/django/pull/945
All tests passing with SQLite.