Skip to content

Commit c83e907

Browse files
committed
tests/extmod: Skip binascii tests when hexlify/unhexlify don't exist.
These functions are only available when `MICROPY_PY_BUILTINS_BYTES_HEX` is enabled. Signed-off-by: Damien George <[email protected]>
1 parent f5cb9eb commit c83e907

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

tests/extmod/binascii_hexlify.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try:
2-
import binascii
2+
from binascii import hexlify
33
except ImportError:
44
print("SKIP")
55
raise SystemExit
@@ -10,10 +10,10 @@
1010
b"\x7f\x80\xff",
1111
b"1234ABCDabcd",
1212
):
13-
print(binascii.hexlify(x))
13+
print(hexlify(x))
1414

1515
# Two-argument version (now supported in CPython)
16-
print(binascii.hexlify(b"123", ":"))
16+
print(hexlify(b"123", ":"))
1717

1818
# zero length buffer
19-
print(binascii.hexlify(b"", b":"))
19+
print(hexlify(b"", b":"))

tests/extmod/binascii_unhexlify.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try:
2-
import binascii
2+
from binascii import unhexlify
33
except ImportError:
44
print("SKIP")
55
raise SystemExit
@@ -10,14 +10,14 @@
1010
b"7f80ff",
1111
b"313233344142434461626364",
1212
):
13-
print(binascii.unhexlify(x))
13+
print(unhexlify(x))
1414

1515
try:
16-
a = binascii.unhexlify(b"0") # odd buffer length
16+
a = unhexlify(b"0") # odd buffer length
1717
except ValueError:
1818
print("ValueError")
1919

2020
try:
21-
a = binascii.unhexlify(b"gg") # digit not hex
21+
a = unhexlify(b"gg") # digit not hex
2222
except ValueError:
2323
print("ValueError")

0 commit comments

Comments
 (0)