Skip to content

Commit

Permalink
tests: Add tests to improve coverage of objarray.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
flowergrass authored and dpgeorge committed Dec 21, 2016
1 parent 531c206 commit 1731868
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/basics/memoryview1.py
Expand Up @@ -28,6 +28,7 @@
# 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])
Expand Down Expand Up @@ -78,3 +79,9 @@
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')
6 changes: 6 additions & 0 deletions tests/misc/non_compliant.py
Expand Up @@ -118,3 +118,9 @@

# struct pack with too few args, not checked by uPy
print(ustruct.pack('bb', 1))

# array slice assignment with unsupported RHS
try:
bytearray(4)[0:1] = [1, 2]
except NotImplementedError:
print('NotImplementedError')
1 change: 1 addition & 0 deletions tests/misc/non_compliant.py.exp
Expand Up @@ -18,3 +18,4 @@ NotImplementedError
NotImplementedError
b'\x01\x02'
b'\x01\x00'
NotImplementedError

0 comments on commit 1731868

Please sign in to comment.