diff options
author | Stefan Krah <skrah@bytereef.org> | 2012-12-16 20:10:35 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2012-12-16 20:10:35 (GMT) |
commit | 9a4ff437d156b3cc9c942473141eafcee79f9d75 (patch) | |
tree | 984afffca959c7e068b87da6651821992b35833b /Lib | |
parent | 92f8b0016e5f4be6f56136a78bb78028d1c74671 (diff) | |
download | cpython-9a4ff437d156b3cc9c942473141eafcee79f9d75.zip cpython-9a4ff437d156b3cc9c942473141eafcee79f9d75.tar.gz cpython-9a4ff437d156b3cc9c942473141eafcee79f9d75.tar.bz2 |
Issue #15783: Support None default values in the Context() constructor.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_decimal.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 0dddc4b..e138709 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -2718,6 +2718,27 @@ class PyPythonAPItests(PythonAPItests): class ContextAPItests(unittest.TestCase): + def test_none_args(self): + Context = self.decimal.Context + InvalidOperation = self.decimal.InvalidOperation + DivisionByZero = self.decimal.DivisionByZero + Overflow = self.decimal.Overflow + ROUND_HALF_EVEN = self.decimal.ROUND_HALF_EVEN + + c1 = Context() + c2 = Context(prec=None, rounding=None, Emax=None, Emin=None, + capitals=None, clamp=None, flags=None, traps=None) + for c in [c1, c2]: + self.assertEqual(c.prec, 28) + self.assertEqual(c.rounding, ROUND_HALF_EVEN) + self.assertEqual(c.Emax, 999999) + self.assertEqual(c.Emin, -999999) + self.assertEqual(c.capitals, 1) + self.assertEqual(c.clamp, 0) + assert_signals(self, c, 'flags', []) + assert_signals(self, c, 'traps', [InvalidOperation, DivisionByZero, + Overflow]) + def test_pickle(self): Context = self.decimal.Context |