2017-12-13 20:25:30 -05:00
|
|
|
# test sys.getsizeof() function
|
|
|
|
|
2022-08-18 02:57:45 -04:00
|
|
|
import sys
|
2017-12-13 20:25:30 -05:00
|
|
|
try:
|
|
|
|
sys.getsizeof
|
|
|
|
except AttributeError:
|
|
|
|
print('SKIP')
|
|
|
|
raise SystemExit
|
|
|
|
|
|
|
|
print(sys.getsizeof([1, 2]) >= 2)
|
|
|
|
print(sys.getsizeof({1: 2}) >= 2)
|
|
|
|
|
|
|
|
class A:
|
|
|
|
pass
|
|
|
|
print(sys.getsizeof(A()) > 0)
|
2018-02-21 07:19:06 -05:00
|
|
|
|
|
|
|
# Only test deque if we have it
|
|
|
|
try:
|
2022-08-18 02:57:45 -04:00
|
|
|
from collections import deque
|
2018-02-21 07:19:06 -05:00
|
|
|
assert sys.getsizeof(deque((), 1)) > 0
|
|
|
|
except ImportError:
|
|
|
|
pass
|