diff options
| author | Damien George | 2014-09-21 23:42:33 +0100 |
|---|---|---|
| committer | Damien George | 2014-09-21 23:43:03 +0100 |
| commit | 2c180f7ccc456e1768fd1cb9a86399808672a237 (patch) | |
| tree | 04c8e64678307a10c8c55ea69a4fea6e506a7ed3 /tests/extmod | |
| parent | df1e92ba3a039738b65486ebbd4428b7740d723d (diff) | |
extmod, ujson: Add test and comment for loads.
Diffstat (limited to 'tests/extmod')
| -rw-r--r-- | tests/extmod/ujson_loads.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/extmod/ujson_loads.py b/tests/extmod/ujson_loads.py new file mode 100644 index 000000000..e064a4c9d --- /dev/null +++ b/tests/extmod/ujson_loads.py @@ -0,0 +1,30 @@ +try: + import ujson as json +except: + import json + +def my_print(o): + if isinstance(o, dict): + print('sorted dict', sorted(o.items())) + else: + print(o) + +my_print(json.loads('null')) +my_print(json.loads('false')) +my_print(json.loads('true')) +my_print(json.loads('1')) +my_print(json.loads('1.2')) +my_print(json.loads('1e2')) +my_print(json.loads('-2')) +my_print(json.loads('-2.3')) +my_print(json.loads('-2e3')) +my_print(json.loads('-2e-3')) +my_print(json.loads('"abc\\u0064e"')) +my_print(json.loads('[]')) +my_print(json.loads('[null]')) +my_print(json.loads('[null,false,true]')) +my_print(json.loads(' [ null , false , true ] ')) +my_print(json.loads('{}')) +my_print(json.loads('{"a":true}')) +my_print(json.loads('{"a":null, "b":false, "c":true}')) +my_print(json.loads('{"a":[], "b":[1], "c":{"3":4}}')) |
