summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-08-02 10:16:33 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-08-02 10:16:33 (GMT)
commit8d238293cd76e019f8b37dcbd62d22b7852c4774 (patch)
tree89a1a15e5e6e13a81301e805719f7dece31867e0 /Lib/test/test_decimal.py
parente634d873155580cac61bbc809a3fdc54c106501e (diff)
downloadcpython-8d238293cd76e019f8b37dcbd62d22b7852c4774.zip
cpython-8d238293cd76e019f8b37dcbd62d22b7852c4774.tar.gz
cpython-8d238293cd76e019f8b37dcbd62d22b7852c4774.tar.bz2
Merged revisions 74279 via svnmerge from
svn+ssh://pythondev@www.python.org/python/branches/py3k ........ r74279 | mark.dickinson | 2009-08-02 11:14:23 +0100 (Sun, 02 Aug 2009) | 1 line 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 ceca186..01deeed 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.'''