2017-12-13 20:25:30 -05:00
|
|
|
# test sys.getsizeof() function
|
|
|
|
|
2020-06-18 05:19:14 -04:00
|
|
|
try:
|
|
|
|
import usys as sys
|
|
|
|
except ImportError:
|
|
|
|
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:
|
|
|
|
from ucollections import deque
|
|
|
|
assert sys.getsizeof(deque((), 1)) > 0
|
|
|
|
except ImportError:
|
|
|
|
pass
|