mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
test_decimal: add __sizeof__() tests for code coverage.
This commit is contained in:
parent
1cfebc73e0
commit
2e537f9edc
1 changed files with 13 additions and 0 deletions
|
@ -5372,6 +5372,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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue