summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-02-18 06:04:26 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-02-18 06:04:26 (GMT)
commitad9a1ba5043d23f4f48d06eb0ce8237d3cdc75d9 (patch)
tree4e868dbdb212c7e842eae0ee33e161a50b5a087b /Lib/test/test_decimal.py
parenta2269d074b02440b7a9c22115454ad7e33aeb3f4 (diff)
downloadcpython-ad9a1ba5043d23f4f48d06eb0ce8237d3cdc75d9.zip
cpython-ad9a1ba5043d23f4f48d06eb0ce8237d3cdc75d9.tar.gz
cpython-ad9a1ba5043d23f4f48d06eb0ce8237d3cdc75d9.tar.bz2
Issue #23474: Enhanced locale testing.
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r--Lib/test/test_decimal.py20
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.'''