summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-08-02 10:14:23 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-08-02 10:14:23 (GMT)
commit345adc43a37cf4640a58cd37df8eaf12f7e55dac (patch)
tree73f2f2382c799ac40da6d1007da9f904c2b27b3b /Lib/test/test_decimal.py
parent642d96a6476199840502a1e98d4902f7f4d47e78 (diff)
downloadcpython-345adc43a37cf4640a58cd37df8eaf12f7e55dac.zip
cpython-345adc43a37cf4640a58cd37df8eaf12f7e55dac.tar.gz
cpython-345adc43a37cf4640a58cd37df8eaf12f7e55dac.tar.bz2
Issue #6595: Allow Decimal constructor to accept non-European decimal digits, as recommended by the specification.
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r--Lib/test/test_decimal.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 43f2a08..927fd1a 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -425,9 +425,6 @@ class DecimalExplicitConstructionTest(unittest.TestCase):
self.assertEqual(str(Decimal('1.3E4 \n')), '1.3E+4')
self.assertEqual(str(Decimal(' -7.89')), '-7.89')
- #but alternate unicode digits should not
- self.assertEqual(str(Decimal('\uff11')), 'NaN')
-
def test_explicit_from_tuples(self):
#zero
@@ -534,6 +531,15 @@ class DecimalExplicitConstructionTest(unittest.TestCase):
d = nc.create_decimal(prevdec)
self.assertEqual(str(d), '5.00E+8')
+ def test_unicode_digits(self):
+ test_values = {
+ '\uff11': '1',
+ '\u0660.\u0660\u0663\u0667\u0662e-\u0663' : '0.0000372',
+ '-nan\u0c68\u0c6a\u0c66\u0c66' : '-NaN2400',
+ }
+ for input, expected in test_values.items():
+ self.assertEqual(str(Decimal(input)), expected)
+
class DecimalImplicitConstructionTest(unittest.TestCase):
'''Unit tests for Implicit Construction cases of Decimal.'''