summaryrefslogtreecommitdiff
path: root/tests/extmod/ujson_loads_bytes.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-08-22 15:45:13 +1000
committerDamien George <damien.p.george@gmail.com>2019-08-22 15:45:13 +1000
commit2eb88f5df74263cf4b458b135d16a100eb7a8bd2 (patch)
tree41f860ebba3e5449cf4072eeb10aa6d8ce3a1670 /tests/extmod/ujson_loads_bytes.py
parent2dfa69efbbae92faf21360edd5e60c5a9145a2dc (diff)
tests/extmod: Split json.loads of bytes/bytearray into separate test.
Because this functionality was introduced in Python 3.6.
Diffstat (limited to 'tests/extmod/ujson_loads_bytes.py')
-rw-r--r--tests/extmod/ujson_loads_bytes.py13
1 files changed, 13 insertions, 0 deletions
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]')))