mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
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:
parent
e634d87315
commit
8d238293cd
4 changed files with 28 additions and 20 deletions
|
@ -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.'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue