RELEASED Python 2.4, alpha 1

I

Irmen de Jong

Tim said:
[Irmen de Jong]
,,,
As Michael Hudson pointed out it's probably a test that
messes with the locale settings and forgets to set them back,
or some such.


In case you don't already know it, regrtest.py's little-used -f
argument lets you specify a file, containing the names of the tests
you want to run.

That was great, I quickly found out that test__locale is the cause.
Not only test_format but also test_unicode fail on my Mandrake 10 box.
My default locale is nl_NL. Behold:

[irmen@atlantis Python-2.4a1]$ cat testcases.in
test__locale
test_format
test_unicode

[irmen@atlantis Python-2.4a1]$ ./python Lib/test/regrtest.py -f testcases.in
test__locale
test_format
test test_format produced unexpected output:
**********************************************************************
*** line 2 of actual output doesn't appear in expected output after line 1:
+ u'%f' % (1.0,) == u'1,000000' != '1.000000'
**********************************************************************
test_unicode
test test_unicode failed -- Traceback (most recent call last):
File "/home/irmen/BUILD/Python-2.4a1/Lib/test/test_unicode.py", line 358, in
test_formatt ing
string_tests.MixinStrUnicodeUserStringTest.test_formatting(self)
File "/home/irmen/BUILD/Python-2.4a1/Lib/test/string_tests.py", line 615, in
test_formatt ing
self.checkequal('0042.00', '%07.2f', '__mod__', 42)
File "/home/irmen/BUILD/Python-2.4a1/Lib/test/string_tests.py", line 56, in checkequal
realresult
AssertionError: u'0042.00' != u'0042,00'

1 test OK.
2 tests failed:
test_format test_unicode
[irmen@atlantis Python-2.4a1]$


--Irmen
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Irmen said:
That was great, I quickly found out that test__locale is the cause.
Not only test_format but also test_unicode fail on my Mandrake 10 box.
My default locale is nl_NL.

Ok. Can you please run test__locale in verbose mode to find out what
the last locale is that it uses? Let's call it X.

Can you please then run interactively

locale.setlocale(locale.LC_NUMERIC, X)
print '%07.2f' % 42

It appears from the test results that this gives '0042,00' for
you; please confirm that it does.

It is bad that test__locale does not restore the locale, but perhaps
we take out that test entirely. However, the behaviour of % is not
supposed to change, so we need to investigate why it changes on your
machine.

Regards,
Martin
 
I

Irmen de Jong

Irmen said:
That was great, I quickly found out that test__locale is the cause.
Not only test_format but also test_unicode fail on my Mandrake 10 box.
My default locale is nl_NL. Behold:
[...]

I just saw that there are already 2 bug reports on this on
the bug tracker, to which I have added my observations:
bug #992078
bug #992081


--Irmen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,042
Latest member
icassiem

Latest Threads

Top