Issue #2478: Decimal(sqrt(0)) failed when the decimal context

was not explicitly supplied.
This commit is contained in:
Mark Dickinson 2008-03-25 14:33:23 +00:00
parent f8f1fbd53c
commit 3b24ccbe7e
3 changed files with 11 additions and 3 deletions

View file

@ -1315,6 +1315,12 @@ class MyDecimal(Decimal):
d = d1.max(d2)
self.assertTrue(type(d) is Decimal)
def test_implicit_context(self):
# Check results when context given implicitly. (Issue 2478)
c = getcontext()
self.assertEqual(str(Decimal(0).sqrt()),
str(c.sqrt(Decimal(0))))
class DecimalPythonAPItests(unittest.TestCase):