From 4cfa136680b5dca161357c672f928387f775a5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Fri, 30 Dec 2005 12:51:45 +0000 Subject: [PATCH] Work around test_locale failing on Solaris. Will backport to 2.4. --- Lib/test/test_locale.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py index 2a33aafb880..1523e77e887 100644 --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -38,13 +38,15 @@ def testformat(formatstr, value, grouping = 0, output=None): print "yes" try: - testformat("%f", 1024, grouping=1, output='1,024.000000') + # On Solaris 10, the thousands_sep is the empty string + sep = locale.localeconv()['thousands_sep'] + testformat("%f", 1024, grouping=1, output='1%s024.000000' % sep) testformat("%f", 102, grouping=1, output='102.000000') testformat("%f", -42, grouping=1, output='-42.000000') testformat("%+f", -42, grouping=1, output='-42.000000') testformat("%20.f", -42, grouping=1, output=' -42') - testformat("%+10.f", -4200, grouping=1, output=' -4,200') - testformat("%-10.f", 4200, grouping=1, output='4,200 ') + testformat("%+10.f", -4200, grouping=1, output=' -4%s200' % sep) + testformat("%-10.f", 4200, grouping=1, output='4%s200 ' % sep) # Invoke getpreferredencoding to make sure it does not cause exceptions, locale.getpreferredencoding() finally: @@ -65,6 +67,9 @@ def teststrop(s, method, output): print "yes" try: + if sys.platform == 'sunos5': + # On Solaris, in en_US.UTF-8, \xa0 is a space + raise locale.Error oldlocale = locale.setlocale(locale.LC_CTYPE) locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8') except locale.Error: