summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/extmod/ujson_loads.py4
-rw-r--r--tests/extmod/ujson_loads_bytes.py13
-rw-r--r--tests/extmod/ujson_loads_bytes.py.exp2
3 files changed, 15 insertions, 4 deletions
diff --git a/tests/extmod/ujson_loads.py b/tests/extmod/ujson_loads.py
index 43672d650..adba3c068 100644
--- a/tests/extmod/ujson_loads.py
+++ b/tests/extmod/ujson_loads.py
@@ -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('')
diff --git a/tests/extmod/ujson_loads_bytes.py b/tests/extmod/ujson_loads_bytes.py
new file mode 100644
index 000000000..507e4ca88
--- /dev/null
+++ b/tests/extmod/ujson_loads_bytes.py
@@ -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]')))
diff --git a/tests/extmod/ujson_loads_bytes.py.exp b/tests/extmod/ujson_loads_bytes.py.exp
new file mode 100644
index 000000000..c2735a990
--- /dev/null
+++ b/tests/extmod/ujson_loads_bytes.py.exp
@@ -0,0 +1,2 @@
+[1, 2]
+[None]