tests/basics: Add coverage tests for memoryview attributes.

This commit is contained in:
Damien George 2019-05-14 17:22:49 +10:00
parent 90fae9172a
commit a474ddf959
2 changed files with 12 additions and 0 deletions

View File

@ -94,3 +94,9 @@ try:
memoryview(array.array('i'))[0:2] = b'1234'
except ValueError:
print('ValueError')
# invalid attribute
try:
memoryview(b'a').noexist
except AttributeError:
print('AttributeError')

View File

@ -7,3 +7,9 @@ except:
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')