(self)
| 269 | self.skipTest('no suitable locales') |
| 270 | |
| 271 | def test_float_parsing(self): |
| 272 | # Bug #1391872: Test whether float parsing is okay on European |
| 273 | # locales. |
| 274 | tested = False |
| 275 | oldloc = setlocale(LC_CTYPE) |
| 276 | for loc in candidate_locales: |
| 277 | try: |
| 278 | setlocale(LC_NUMERIC, loc) |
| 279 | except Error: |
| 280 | continue |
| 281 | |
| 282 | # Ignore buggy locale databases. (Mac OS 10.4 and some other BSDs) |
| 283 | if loc == 'eu_ES' and localeconv()['decimal_point'] == "' ": |
| 284 | continue |
| 285 | |
| 286 | self.assertEqual(int(eval('3.14') * 100), 314, |
| 287 | "using eval('3.14') failed for %s" % loc) |
| 288 | self.assertEqual(int(float('3.14') * 100), 314, |
| 289 | "using float('3.14') failed for %s" % loc) |
| 290 | if localeconv()['decimal_point'] != '.': |
| 291 | self.assertRaises(ValueError, float, |
| 292 | localeconv()['decimal_point'].join(['1', '23'])) |
| 293 | tested = True |
| 294 | self.assertEqual(setlocale(LC_CTYPE), oldloc) |
| 295 | if not tested: |
| 296 | self.skipTest('no suitable locales') |
| 297 | |
| 298 | |
| 299 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected