summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/memoryview_itemsize.py
blob: cd7a87c23dfea4fc0ca504f0914953764590682c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
try:
    memoryview(b'a').itemsize
except:
    print("SKIP")
    raise SystemExit
try:
    from uarray import array
except ImportError:
    try:
        from array import array
    except ImportError:
        print("SKIP")
        raise SystemExit

for code in ['b', 'h', 'i', 'l', 'q', 'f', 'd']:
    print(memoryview(array(code)).itemsize)

# shouldn't be able to store to the itemsize attribute
try:
    memoryview(b'a').itemsize = 1
except AttributeError:
    print('AttributeError')