Skip to content

Commit

Permalink
tests/memoryview*: Move array-related test to memoryview2.py test.
Browse files Browse the repository at this point in the history
memoryview2.py already has guard for uarray module, so move a testcase
there to preclude it failing if the module is not enabled.

Change-Id: I8dbac062a2e1750d75eada75cb66c41814fee255
Signed-off-by: Paul Sokolovsky <[email protected]>
  • Loading branch information
pfalcon committed Dec 14, 2021
1 parent a4b3f2c commit 13fb23b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
11 changes: 0 additions & 11 deletions tests/basics/memoryview1.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@
print(bytearray(m))
print(list(memoryview(memoryview(b'1234')))) # read-only memoryview

try:
import uarray as array
except ImportError:
import array
a = array.array('i', [1, 2, 3, 4])
m = memoryview(a)
print(list(m))
print(list(m[1:-1]))
m[2] = 6
print(a)

# invalid attribute
try:
memoryview(b'a').noexist
Expand Down
9 changes: 8 additions & 1 deletion tests/basics/memoryview2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# test memoryview accessing maximum values for signed/unsigned elements
# test memoryview with arrays and accessing maximum values for signed/unsigned elements
try:
from uarray import array
except ImportError:
Expand All @@ -14,6 +14,13 @@
print("SKIP")
raise SystemExit

a = array('i', [1, 2, 3, 4])
m = memoryview(a)
print(list(m))
print(list(m[1:-1]))
m[2] = 6
print(a)

print(list(memoryview(b'\x7f\x80\x81\xff')))
print(list(memoryview(array('b', [0x7f, -0x80]))))
print(list(memoryview(array('B', [0x7f, 0x80, 0x81, 0xff]))))
Expand Down

0 comments on commit 13fb23b

Please sign in to comment.