summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/uctypes_addressof.py
blob: c83089d0f72af940a69db72f80b184774cb2889e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Test uctypes.addressof().

try:
    from sys import maxsize
    import uctypes
except ImportError:
    print("SKIP")
    raise SystemExit

# Test small addresses.
for i in range(8):
    print(uctypes.addressof(uctypes.bytearray_at(1 << i, 8)))

# Test address that is bigger than the greatest small-int but still within the address range.
large_addr = maxsize + 1
print(uctypes.addressof(uctypes.bytearray_at(large_addr, 8)) == large_addr)