summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2008-03-25 14:33:23 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2008-03-25 14:33:23 (GMT)
commit3b24ccbe7e2b43c4373e4b1e988df55978b819e7 (patch)
treec52e728abc2a9a08812e9222d6b3d09e63f6bcea /Lib/test/test_decimal.py
parentf8f1fbd53c3a2b7fdda863f11242a976ec490e8f (diff)
downloadcpython-3b24ccbe7e2b43c4373e4b1e988df55978b819e7.zip
cpython-3b24ccbe7e2b43c4373e4b1e988df55978b819e7.tar.gz
cpython-3b24ccbe7e2b43c4373e4b1e988df55978b819e7.tar.bz2
Issue #2478: Decimal(sqrt(0)) failed when the decimal context
was not explicitly supplied.
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r--Lib/test/test_decimal.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 5e53318..46d2dc7 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -1315,6 +1315,12 @@ class DecimalUsabilityTest(unittest.TestCase):
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):