tests/basics: Add coverage tests for memoryview attributes.
This commit is contained in:
parent
90fae9172a
commit
a474ddf959
@ -94,3 +94,9 @@ try:
|
|||||||
memoryview(array.array('i'))[0:2] = b'1234'
|
memoryview(array.array('i'))[0:2] = b'1234'
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print('ValueError')
|
print('ValueError')
|
||||||
|
|
||||||
|
# invalid attribute
|
||||||
|
try:
|
||||||
|
memoryview(b'a').noexist
|
||||||
|
except AttributeError:
|
||||||
|
print('AttributeError')
|
||||||
|
@ -7,3 +7,9 @@ except:
|
|||||||
|
|
||||||
for code in ['b', 'h', 'i', 'l', 'q', 'f', 'd']:
|
for code in ['b', 'h', 'i', 'l', 'q', 'f', 'd']:
|
||||||
print(memoryview(array(code)).itemsize)
|
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')
|
||||||
|
Loading…
Reference in New Issue
Block a user