[Python-checkins] r81977 - python/branches/py3k-cdecimal/Lib/test/decimal_tests.py

stefan.krah python-checkins at python.org
Mon Jun 14 11:14:14 CEST 2010


Author: stefan.krah
Date: Mon Jun 14 11:14:14 2010
New Revision: 81977

Log:
Test correct setting of traps in DefaultContext and BasicContext.

Modified:
   python/branches/py3k-cdecimal/Lib/test/decimal_tests.py

Modified: python/branches/py3k-cdecimal/Lib/test/decimal_tests.py
==============================================================================
--- python/branches/py3k-cdecimal/Lib/test/decimal_tests.py	(original)
+++ python/branches/py3k-cdecimal/Lib/test/decimal_tests.py	Mon Jun 14 11:14:14 2010
@@ -2585,6 +2585,13 @@
 
 class SpecialContexts(unittest.TestCase):
     def test_context_templates(self):
+        if HAVE_CDECIMAL:
+            self.assertEqual(
+                BasicContext._traps,
+                DecIEEEInvalidOperation|DecDivisionByZero|DecOverflow|
+                DecUnderflow|DecClamped
+            )
+
         basic_context_prec = BasicContext.prec
         extended_context_prec = ExtendedContext.prec
 
@@ -2600,6 +2607,12 @@
         ExtendedContext.prec = extended_context_prec
 
     def test_default_context(self):
+        if HAVE_CDECIMAL:
+            self.assertEqual(
+                DefaultContext._traps,
+                DecIEEEInvalidOperation|DecDivisionByZero|DecOverflow
+            )
+
         default_context_prec = DefaultContext.prec
 
         c = getcontext()


More information about the Python-checkins mailing list