Fixed #29534 - _decimal difference with _pydecimal (#65)

This commit is contained in:
Andrew Nester 2017-02-14 21:22:55 +03:00 committed by Mark Dickinson
parent c33ee85b6f
commit 6d1dece06d
3 changed files with 28 additions and 11 deletions

View file

@ -1185,6 +1185,16 @@ class FormatTest(unittest.TestCase):
self.assertEqual(format(Decimal('100000000.123'), 'n'),
'100\u066c000\u066c000\u066b123')
def test_decimal_from_float_argument_type(self):
class A(self.decimal.Decimal):
def __init__(self, a):
self.a_type = type(a)
a = A.from_float(42.5)
self.assertEqual(self.decimal.Decimal, a.a_type)
a = A.from_float(42)
self.assertEqual(self.decimal.Decimal, a.a_type)
class CFormatTest(FormatTest):
decimal = C
class PyFormatTest(FormatTest):