diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 68ea9f7f726424..6b9bbb97045ffb 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -1035,6 +1035,8 @@ function to temporarily change the active context. IEEE interchange formats. The argument must be a multiple of 32 and less than :const:`IEEE_CONTEXT_MAX_BITS`. + .. versionadded:: 3.14 + New contexts can also be created using the :class:`Context` constructor described below. In addition, the module provides three pre-made contexts: diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 5f0685dcd0a31e..9f972c0625612f 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -4417,15 +4417,15 @@ def assert_rest(self, context): assert_rest(self, c) # Invalid values - self.assertRaises(OverflowError, IEEEContext, 2**63) + self.assertRaises(OverflowError, IEEEContext, sys.maxsize + 1) self.assertRaises(ValueError, IEEEContext, -1) + self.assertRaises(ValueError, IEEEContext, 123) self.assertRaises(ValueError, IEEEContext, 1024) def test_constants(self): # IEEEContext IEEE_CONTEXT_MAX_BITS = self.decimal.IEEE_CONTEXT_MAX_BITS - if IEEE_CONTEXT_MAX_BITS != 256: - self.assertEqual(IEEE_CONTEXT_MAX_BITS, 512) + self.assertIn(IEEE_CONTEXT_MAX_BITS, {256, 512}) @requires_cdecimal class CIEEEContexts(IEEEContexts, unittest.TestCase):