(self)
| 176 | |
| 177 | @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") |
| 178 | def test_lc_numeric_basic(self): |
| 179 | # Test nl_langinfo against localeconv |
| 180 | tested = False |
| 181 | oldloc = setlocale(LC_CTYPE) |
| 182 | for loc in candidate_locales: |
| 183 | try: |
| 184 | setlocale(LC_NUMERIC, loc) |
| 185 | except Error: |
| 186 | continue |
| 187 | for li, lc in ((RADIXCHAR, "decimal_point"), |
| 188 | (THOUSEP, "thousands_sep")): |
| 189 | nl_radixchar = nl_langinfo(li) |
| 190 | li_radixchar = localeconv()[lc] |
| 191 | try: |
| 192 | set_locale = setlocale(LC_NUMERIC) |
| 193 | except Error: |
| 194 | set_locale = "<not able to determine>" |
| 195 | self.assertEqual(nl_radixchar, li_radixchar, |
| 196 | "%s (nl_langinfo) != %s (localeconv) " |
| 197 | "(set to %s, using %s)" % ( |
| 198 | nl_radixchar, li_radixchar, |
| 199 | loc, set_locale)) |
| 200 | tested = True |
| 201 | self.assertEqual(setlocale(LC_CTYPE), oldloc) |
| 202 | if not tested: |
| 203 | self.skipTest('no suitable locales') |
| 204 | |
| 205 | @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") |
| 206 | @unittest.skipUnless(hasattr(locale, 'ALT_DIGITS'), "requires locale.ALT_DIGITS") |
nothing calls this directly
no test coverage detected