tests: Rename "array" module to "uarray".

This commit is contained in:
Damien George 2019-10-22 17:33:23 +11:00
parent a2eea57b1d
commit 30e25174bb
26 changed files with 152 additions and 63 deletions

View File

@ -1,3 +1,6 @@
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:

View File

@ -1,4 +1,7 @@
# test array + array
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:

View File

@ -1,5 +1,8 @@
# test construction of array.array from different objects
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,3 +1,6 @@
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,5 +1,8 @@
# test construction of array.array from different objects
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,5 +1,8 @@
# test array types QqLl that require big-ints
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,4 +1,7 @@
# test MicroPython-specific features of array.array
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:

View File

@ -1,4 +1,7 @@
# test construction of bytearray from different objects
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,4 +1,7 @@
# test construction of bytearray from different objects
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,4 +1,7 @@
# test bytes + other
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:

View File

@ -1,4 +1,7 @@
# test bytes + other
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:

View File

@ -1,3 +1,6 @@
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:

View File

@ -1,4 +1,7 @@
# test construction of bytes from different objects
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,5 +1,8 @@
# test construction of bytes from different objects
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -4,6 +4,14 @@ try:
except:
print("SKIP")
raise SystemExit
try:
import uarray as array
except ImportError:
try:
import array
except ImportError:
print("SKIP")
raise SystemExit
# test reading from bytes
b = b'1234'
@ -39,7 +47,6 @@ 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])
m = memoryview(a)
print(list(m))

View File

@ -1,10 +1,17 @@
# test memoryview accessing maximum values for signed/unsigned elements
try:
from array import array
memoryview
except:
print("SKIP")
raise SystemExit
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:
print("SKIP")
raise SystemExit
print(list(memoryview(b'\x7f\x80\x81\xff')))
print(list(memoryview(array('b', [0x7f, -0x80]))))

View File

@ -1,10 +1,17 @@
# test memoryview accessing maximum values for signed/unsigned elements
try:
from array import array
memoryview
except:
print("SKIP")
raise SystemExit
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:
print("SKIP")
raise SystemExit
print(list(memoryview(array('i', [0x7f000000, -0x80000000]))))
print(list(memoryview(array('I', [0x7f000000, 0x80000000, 0x81000000, 0xffffffff]))))

View File

@ -1,9 +1,16 @@
try:
memoryview(b'a').itemsize
from array import array
except:
print("SKIP")
raise SystemExit
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:
print("SKIP")
raise SystemExit
for code in ['b', 'h', 'i', 'l', 'q', 'f', 'd']:
print(memoryview(array(code)).itemsize)

View File

@ -1,5 +1,8 @@
# test construction of array from array with float type
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,5 +1,8 @@
# test construction of bytearray from array with float type
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,5 +1,8 @@
# test construction of bytearray from array with float type
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,3 +1,6 @@
try:
from uarray import array
except ImportError:
try:
from array import array
except ImportError:

View File

@ -1,4 +1,4 @@
import array
import uarray as array
@micropython.asm_thumb # test vldr, vstr
def arrayadd(r0):
vldr(s0, [r0, 0])

View File

@ -46,7 +46,7 @@ def asm_sum_bytes(r0, r1):
mov(r0, r2)
import array
import uarray as array
b = array.array('l', (100, 200, 300, 400))
n = asm_sum_words(len(b), b)

View File

@ -1,8 +1,15 @@
# test that iterating doesn't use the heap
try:
frozenset
except NameError:
print("SKIP")
raise SystemExit
try:
import uarray as array
except ImportError:
try:
import array
except (NameError, ImportError):
except ImportError:
print("SKIP")
raise SystemExit

View File

@ -1,7 +1,7 @@
# tests for things that are not implemented, or have non-compliant behaviour
try:
import array
import uarray as array
import ustruct
except ImportError:
print("SKIP")