Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
c15ebf7c
Commit
c15ebf7c
authored
Dec 29, 2016
by
Rami Ali
Committed by
Damien George
Dec 29, 2016
Browse files
tests/extmod: Improve ubinascii.c test coverage.
parent
45a8cc8f
Changes
5
Hide whitespace changes
Inline
Side-by-side
tests/extmod/ubinascii_a2b_base64.py
View file @
c15ebf7c
...
...
@@ -14,6 +14,7 @@ print(binascii.a2b_base64(b'Zm9vYmFy'))
print
(
binascii
.
a2b_base64
(
b
'AAECAwQFBgc='
))
print
(
binascii
.
a2b_base64
(
b
'CAkKCwwNDg8='
))
print
(
binascii
.
a2b_base64
(
b
'f4D/'
))
print
(
binascii
.
a2b_base64
(
b
'f4D+'
))
# convert '+'
print
(
binascii
.
a2b_base64
(
b
'MTIzNEFCQ0RhYmNk'
))
try
:
...
...
tests/extmod/ubinascii_b2a_base64.py
View file @
c15ebf7c
...
...
@@ -15,3 +15,4 @@ print(binascii.b2a_base64(b'\x00\x01\x02\x03\x04\x05\x06\x07'))
print
(
binascii
.
b2a_base64
(
b
'
\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f
'
))
print
(
binascii
.
b2a_base64
(
b
'
\x7f\x80\xff
'
))
print
(
binascii
.
b2a_base64
(
b
'1234ABCDabcd'
))
print
(
binascii
.
b2a_base64
(
b
'
\x00\x00
>'
))
# convert into '+'
tests/extmod/ubinascii_micropython.py
0 → 100644
View file @
c15ebf7c
try
:
import
ubinascii
as
binascii
except
ImportError
:
import
binascii
# two arguments supported in uPy but not CPython
a
=
binascii
.
hexlify
(
b
'123'
,
':'
)
print
(
a
)
tests/extmod/ubinascii_micropython.py.exp
0 → 100644
View file @
c15ebf7c
b'31:32:33'
tests/extmod/ubinascii_unhexlify.py
View file @
c15ebf7c
...
...
@@ -7,3 +7,13 @@ print(binascii.unhexlify(b'0001020304050607'))
print
(
binascii
.
unhexlify
(
b
'08090a0b0c0d0e0f'
))
print
(
binascii
.
unhexlify
(
b
'7f80ff'
))
print
(
binascii
.
unhexlify
(
b
'313233344142434461626364'
))
try
:
a
=
binascii
.
unhexlify
(
b
'0'
)
# odd buffer length
except
ValueError
:
print
(
'ValueError'
)
try
:
a
=
binascii
.
unhexlify
(
b
'gg'
)
# digit not hex
except
ValueError
:
print
(
'ValueError'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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