tests/extmod: Split json.loads of bytes/bytearray into separate test.
Because this functionality was introduced in Python 3.6.pull/1/head
parent
2dfa69efbb
commit
2eb88f5df7
|
@ -37,10 +37,6 @@ my_print(json.loads('"abc\\uabcd"'))
|
||||||
# whitespace handling
|
# whitespace handling
|
||||||
my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}'))
|
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
|
# loading nothing should raise exception
|
||||||
try:
|
try:
|
||||||
json.loads('')
|
json.loads('')
|
||||||
|
|
|
@ -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]')))
|
|
@ -0,0 +1,2 @@
|
||||||
|
[1, 2]
|
||||||
|
[None]
|
Loading…
Reference in New Issue