Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
1731868a
Commit
1731868a
authored
Dec 21, 2016
by
Rami Ali
Committed by
Damien George
Dec 21, 2016
Browse files
tests: Add tests to improve coverage of objarray.c.
parent
531c206e
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/basics/memoryview1.py
View file @
1731868a
...
@@ -28,6 +28,7 @@ print(list(m[1:-1]))
...
@@ -28,6 +28,7 @@ print(list(m[1:-1]))
# this tests get_buffer of memoryview
# this tests get_buffer of memoryview
m
=
memoryview
(
bytearray
(
2
))
m
=
memoryview
(
bytearray
(
2
))
print
(
bytearray
(
m
))
print
(
bytearray
(
m
))
print
(
list
(
memoryview
(
memoryview
(
b
'1234'
))))
# read-only memoryview
import
array
import
array
a
=
array
.
array
(
'i'
,
[
1
,
2
,
3
,
4
])
a
=
array
.
array
(
'i'
,
[
1
,
2
,
3
,
4
])
...
@@ -78,3 +79,9 @@ try:
...
@@ -78,3 +79,9 @@ try:
m4
[
1
:
3
]
=
m2
[
1
:
3
]
m4
[
1
:
3
]
=
m2
[
1
:
3
]
except
ValueError
:
except
ValueError
:
print
(
"ValueError"
)
print
(
"ValueError"
)
# invalid assignment on RHS
try
:
memoryview
(
array
.
array
(
'i'
))[
0
:
2
]
=
b
'1234'
except
ValueError
:
print
(
'ValueError'
)
tests/misc/non_compliant.py
View file @
1731868a
...
@@ -118,3 +118,9 @@ print(ustruct.pack('bb', 1, 2, 3))
...
@@ -118,3 +118,9 @@ print(ustruct.pack('bb', 1, 2, 3))
# struct pack with too few args, not checked by uPy
# struct pack with too few args, not checked by uPy
print
(
ustruct
.
pack
(
'bb'
,
1
))
print
(
ustruct
.
pack
(
'bb'
,
1
))
# array slice assignment with unsupported RHS
try
:
bytearray
(
4
)[
0
:
1
]
=
[
1
,
2
]
except
NotImplementedError
:
print
(
'NotImplementedError'
)
tests/misc/non_compliant.py.exp
View file @
1731868a
...
@@ -18,3 +18,4 @@ NotImplementedError
...
@@ -18,3 +18,4 @@ NotImplementedError
NotImplementedError
NotImplementedError
b'\x01\x02'
b'\x01\x02'
b'\x01\x00'
b'\x01\x00'
NotImplementedError
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment