summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Leech <andrew.leech@planetinnovation.com.au>2019-11-11 15:44:04 +1100
committerDamien George <damien.p.george@gmail.com>2019-11-13 13:51:18 +1100
commit1e87f11d3f2673ace3f36dd24bdc095bb25583e4 (patch)
treeb61f27ae789f16e5ca3a7dde9e5ed8cf8db7e07b /tests
parent82d358510b38b092dac204786c193d8109dcf886 (diff)
py/objdict: Support ujson.dump() of OrderedDict objects.
Following CPython, OrderedDict are dumped with the syntax of dict.
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/ujson_dumps_ordereddict.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/extmod/ujson_dumps_ordereddict.py b/tests/extmod/ujson_dumps_ordereddict.py
new file mode 100644
index 000000000..c6f4a8fcb
--- /dev/null
+++ b/tests/extmod/ujson_dumps_ordereddict.py
@@ -0,0 +1,12 @@
+try:
+ import ujson as json
+ from ucollections import OrderedDict
+except ImportError:
+ try:
+ import json
+ from collections import OrderedDict
+ except ImportError:
+ print("SKIP")
+ raise SystemExit
+
+print(json.dumps(OrderedDict(((1, 2), (3, 4)))))