diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2005-12-30 12:51:45 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2005-12-30 12:51:45 (GMT) |
commit | 4cfa136680b5dca161357c672f928387f775a5fd (patch) | |
tree | b924bade597cd2f3ddf75c02170a61da0ca91de2 /Lib | |
parent | d5845ec32ec0911eb82619274090ec4c2e06150e (diff) | |
download | cpython-4cfa136680b5dca161357c672f928387f775a5fd.zip cpython-4cfa136680b5dca161357c672f928387f775a5fd.tar.gz cpython-4cfa136680b5dca161357c672f928387f775a5fd.tar.bz2 |
Work around test_locale failing on Solaris.
Will backport to 2.4.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_locale.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py index 2a33aaf..1523e77 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: |