﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20059	Test failure in humanize app for some languages	orangain@…	matiasb	"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 ===

1. Create a new project.
{{{
$ pip install django==1.5
$ django-admin.py startproject sample
}}}

2. 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
)
}}}

3. 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, but {{{python manage.py test}}} succeeded."	Bug	closed	contrib.humanize	1.5	Normal	fixed			Accepted	1	0	0	0	0	0
