diff options
Diffstat (limited to 'Lib/test/test_decimal.py')
| -rw-r--r-- | Lib/test/test_decimal.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 4031347..8358ba6e 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -2431,6 +2431,23 @@ class PythonAPItests(unittest.TestCase): self.assertIsInstance(r, C.Decimal) self.assertEqual(r, x) + x = C.Decimal('-3.123e81723').as_tuple() + y = P.Decimal('-3.123e81723').as_tuple() + + sys.modules['decimal'] = C + sx = pickle.dumps(x) + sys.modules['decimal'] = P + r = pickle.loads(sx) + self.assertIsInstance(r, P.DecimalTuple) + self.assertEqual(r, y) + + sys.modules['decimal'] = P + sy = pickle.dumps(y) + sys.modules['decimal'] = C + r = pickle.loads(sy) + self.assertIsInstance(r, C.DecimalTuple) + self.assertEqual(r, x) + sys.modules['decimal'] = savedecimal def test_int(self): @@ -5412,7 +5429,7 @@ else: all_tests.insert(0, CheckAttributes) -def test_main(arith=False, verbose=None, todo_tests=None, debug=None): +def test_main(arith=None, verbose=None, todo_tests=None, debug=None): """ Execute the tests. Runs all arithmetic tests if arith is True or if the "decimal" resource @@ -5422,7 +5439,7 @@ def test_main(arith=False, verbose=None, todo_tests=None, debug=None): init(C) init(P) global TEST_ALL, DEBUG - TEST_ALL = arith or is_resource_enabled('decimal') + TEST_ALL = arith if arith is not None else is_resource_enabled('decimal') DEBUG = debug if todo_tests is None: |
