mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
Issue #2478: Decimal(sqrt(0)) failed when the decimal context
was not explicitly supplied.
This commit is contained in:
parent
f8f1fbd53c
commit
3b24ccbe7e
3 changed files with 11 additions and 3 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue