[Python-checkins] cpython: test_decimal: add __sizeof__() tests for code coverage.
stefan.krah
python-checkins at python.org
Wed May 29 18:51:03 CEST 2013
http://hg.python.org/cpython/rev/bcaaaa00425b
changeset: 83977:bcaaaa00425b
user: Stefan Krah <skrah at bytereef.org>
date: Wed May 29 18:50:06 2013 +0200
summary:
test_decimal: add __sizeof__() tests for code coverage.
files:
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
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -5372,6 +5372,19 @@
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,
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list