circuitpython/tests/basics/sys_getsizeof.py
Jim Mussared 4216bc7d13 tests: Replace umodule with module everywhere.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:24 +10:00

23 lines
391 B
Python

# 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 collections import deque
assert sys.getsizeof(deque((), 1)) > 0
except ImportError:
pass