diff options
Diffstat (limited to 'Lib/test/test_decimal.py')
| -rw-r--r-- | Lib/test/test_decimal.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index de309ba..3b3d9d1 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -32,7 +32,8 @@ import unittest from decimal import * import numbers from test.test_support import (run_unittest, run_doctest, requires_unicode, u, - is_resource_enabled, check_py3k_warnings) + is_resource_enabled, check_py3k_warnings, + run_with_locale) import random try: import threading @@ -905,6 +906,23 @@ class DecimalFormatTest(unittest.TestCase): self.assertEqual(get_fmt(123456, crazy, '012n'), '00-01-2345-6') self.assertEqual(get_fmt(123456, crazy, '013n'), '000-01-2345-6') + @run_with_locale('LC_ALL', 'ps_AF.UTF-8') + def test_wide_char_separator_decimal_point(self): + # locale with wide char separator and decimal point + import locale + + decimal_point = locale.localeconv()['decimal_point'] + thousands_sep = locale.localeconv()['thousands_sep'] + if decimal_point != '\xd9\xab': + self.skipTest('inappropriate decimal point separator' + '({!r} not {!r})'.format(decimal_point, '\xd9\xab')) + if thousands_sep != '\xd9\xac': + self.skipTest('inappropriate thousands separator' + '({!r} not {!r})'.format(thousands_sep, '\xd9\xac')) + + self.assertEqual(format(Decimal('100000000.123'), 'n'), + '100\xd9\xac000\xd9\xac000\xd9\xab123') + class DecimalArithmeticOperatorsTest(unittest.TestCase): '''Unit tests for all arithmetic operators, binary and unary.''' |
