diff options
author | Stefan Krah <skrah@bytereef.org> | 2013-05-29 17:14:17 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2013-05-29 17:14:17 (GMT) |
commit | 891ca9e06ad6d0bab06573590f9100a28d9dfbfe (patch) | |
tree | bc48c0505ade62d89f74e0c4caf71efdb40cb40d /Lib/test/test_decimal.py | |
parent | 6edda14b2968ca07b94a2fdde4dd43215222fcd8 (diff) | |
download | cpython-891ca9e06ad6d0bab06573590f9100a28d9dfbfe.zip cpython-891ca9e06ad6d0bab06573590f9100a28d9dfbfe.tar.gz cpython-891ca9e06ad6d0bab06573590f9100a28d9dfbfe.tar.bz2 |
Backport bff16086f03b and bcaaaa00425b.
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r-- | Lib/test/test_decimal.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 2969394..50a9ad4 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -5373,6 +5373,19 @@ class CWhitebox(unittest.TestCase): x = (1, (0, 1), "N") self.assertEqual(str(Decimal(x)), '-sNaN1') + def test_sizeof(self): + Decimal = C.Decimal + HAVE_CONFIG_64 = (C.MAX_PREC > 425000000) + + self.assertGreater(Decimal(0).__sizeof__(), 0) + if HAVE_CONFIG_64: + x = Decimal(10**(19*24)).__sizeof__() + y = Decimal(10**(19*25)).__sizeof__() + self.assertEqual(y, x+8) + else: + x = Decimal(10**(9*24)).__sizeof__() + y = Decimal(10**(9*25)).__sizeof__() + self.assertEqual(y, x+4) all_tests = [ CExplicitConstructionTest, PyExplicitConstructionTest, |