summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/memoryview1.py
diff options
context:
space:
mode:
authorRami Ali <flowergrass@users.noreply.github.com>2016-12-21 17:51:42 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-21 18:21:41 +1100
commit1731868ae7a2d22e26e9ed939be18929fed81400 (patch)
tree8536a27d6461a0eaf05296b9386a818bc86648cf /tests/basics/memoryview1.py
parent531c206e8b2e4d1af735af473c2fdeb8c1b36247 (diff)
downloadmicropython-1731868ae7a2d22e26e9ed939be18929fed81400.tar.gz
micropython-1731868ae7a2d22e26e9ed939be18929fed81400.zip
tests: Add tests to improve coverage of objarray.c.
Diffstat (limited to 'tests/basics/memoryview1.py')
-rw-r--r--tests/basics/memoryview1.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/basics/memoryview1.py b/tests/basics/memoryview1.py
index 862a573e84..1cd411195d 100644
--- a/tests/basics/memoryview1.py
+++ b/tests/basics/memoryview1.py
@@ -28,6 +28,7 @@ print(list(m[1:-1]))
# this tests get_buffer of memoryview
m = memoryview(bytearray(2))
print(bytearray(m))
+print(list(memoryview(memoryview(b'1234')))) # read-only memoryview
import array
a = array.array('i', [1, 2, 3, 4])
@@ -78,3 +79,9 @@ try:
m4[1:3] = m2[1:3]
except ValueError:
print("ValueError")
+
+# invalid assignment on RHS
+try:
+ memoryview(array.array('i'))[0:2] = b'1234'
+except ValueError:
+ print('ValueError')