tests/extmod: Split json.loads of bytes/bytearray into separate test.

Because this functionality was introduced in Python 3.6.
This commit is contained in:
Damien George 2019-08-22 15:45:13 +10:00
parent 2dfa69efbb
commit 2eb88f5df7
3 changed files with 15 additions and 4 deletions

View File

@ -37,10 +37,6 @@ my_print(json.loads('"abc\\uabcd"'))
# whitespace handling
my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}'))
# loading from bytes and bytearray
my_print(json.loads(b'[1,2]'))
my_print(json.loads(bytearray(b'[null]')))
# loading nothing should raise exception
try:
json.loads('')

View File

@ -0,0 +1,13 @@
# test loading from bytes and bytearray (introduced in Python 3.6)
try:
import ujson as json
except ImportError:
try:
import json
except ImportError:
print("SKIP")
raise SystemExit
print(json.loads(b'[1,2]'))
print(json.loads(bytearray(b'[null]')))

View File

@ -0,0 +1,2 @@
[1, 2]
[None]