diff --git a/tests/basics/memoryview1.py b/tests/basics/memoryview1.py index c4cc6ffab7..a0ac9e3449 100644 --- a/tests/basics/memoryview1.py +++ b/tests/basics/memoryview1.py @@ -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') diff --git a/tests/basics/memoryview_itemsize.py b/tests/basics/memoryview_itemsize.py index 108c69cfdc..60cb823087 100644 --- a/tests/basics/memoryview_itemsize.py +++ b/tests/basics/memoryview_itemsize.py @@ -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')