You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
392 B
23 lines
392 B
4 years ago
|
# test sys.getsizeof() function
|
||
|
|
||
|
import sys
|
||
|
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)
|
||
|
|
||
|
# Only test deque if we have it
|
||
|
try:
|
||
|
from ucollections import deque
|
||
|
assert sys.getsizeof(deque((), 1)) > 0
|
||
|
except ImportError:
|
||
|
pass
|