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.
........
This commit is contained in:
Mark Dickinson 2009-08-02 10:16:33 +00:00
parent e634d87315
commit 8d238293cd
4 changed files with 28 additions and 20 deletions

View file

@ -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.'''