diff options
author | Brett Cannon <bcannon@gmail.com> | 2004-09-08 02:02:41 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2004-09-08 02:02:41 (GMT) |
commit | 85ae1a69b63451cdcfeb45af699ea0c014971217 (patch) | |
tree | 0e58d672063e1c96f9d19c0b73cf78f6c2939262 | |
parent | 69652035bc2cf22b0326bb00824f4b7e2674cc8b (diff) | |
download | cpython-85ae1a69b63451cdcfeb45af699ea0c014971217.zip cpython-85ae1a69b63451cdcfeb45af699ea0c014971217.tar.gz cpython-85ae1a69b63451cdcfeb45af699ea0c014971217.tar.bz2 |
Remove usage of locale.getlocale in favor or setlocale(LC_NUMERIC, None) .
Also added a comment about why the code is bother to see what setlocale thinks
the set locale is.
Closes bug #1023798.
-rw-r--r-- | Lib/test/test__locale.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/test__locale.py b/Lib/test/test__locale.py index e0f64ec..abf7a5b 100644 --- a/Lib/test/test__locale.py +++ b/Lib/test/test__locale.py @@ -1,7 +1,6 @@ from test.test_support import verbose, TestSkipped, run_unittest from _locale import (setlocale, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo, localeconv, Error) -from locale import getlocale import unittest candidate_locales = ['es_UY', 'fr_FR', 'fi_FI', 'es_CO', 'pt_PT', 'it_IT', @@ -33,11 +32,18 @@ class _LocaleTests(unittest.TestCase): (THOUSEP, "thousands_sep")): nl_radixchar = nl_langinfo(li) li_radixchar = localeconv()[lc] + # Both with seeing what the locale is set to in order to detect + # when setlocale lies and says it accepted the locale setting + # but in actuality didn't use it (as seen in OS X 10.3) + try: + set_locale = setlocale(LC_NUMERIC) + except Error: + set_locale = "<not able to determine>" self.assertEquals(nl_radixchar, li_radixchar, - "%r != %r (%s); " + "%s != %s (%s); " "supposed to be %s, set to %s" % (nl_radixchar, li_radixchar, lc, - loc, getlocale(LC_NUMERIC)[0])) + loc, set_locale)) def test_main(): run_unittest(_LocaleTests) |