Issue #16431: Use the type information when constructing a Decimal subtype

from a Decimal argument.
This commit is contained in:
Stefan Krah 2012-11-07 23:12:25 +01:00
parent 33363f43e3
commit f4abc7b8a0
3 changed files with 35 additions and 2 deletions

View file

@ -2047,6 +2047,11 @@ class UsabilityTest(unittest.TestCase):
self.assertIs(type(d), MyDecimal)
self.assertEqual(d, d1)
a = Decimal('1.0')
b = MyDecimal(a)
self.assertIs(type(b), MyDecimal)
self.assertEqual(a, b)
def test_implicit_context(self):
Decimal = self.decimal.Decimal
getcontext = self.decimal.getcontext