diff options
| author | Damien George | 2015-06-25 10:50:00 +0100 |
|---|---|---|
| committer | Damien George | 2015-06-25 10:50:00 +0100 |
| commit | e44c1d3acef6d1a81e9496d1a4a8c4d12e2fd0a6 (patch) | |
| tree | 4e52070b638ed299323e9ee0f9a151740e1da06e /tests/extmod | |
| parent | 186b355b286d00a46b3eb1db6341c17763f30f10 (diff) | |
tests: Split out json float tests to separate files.
Diffstat (limited to 'tests/extmod')
| -rw-r--r-- | tests/extmod/ujson_dumps.py | 1 | ||||
| -rw-r--r-- | tests/extmod/ujson_dumps_float.py | 6 | ||||
| -rw-r--r-- | tests/extmod/ujson_loads.py | 7 | ||||
| -rw-r--r-- | tests/extmod/ujson_loads_float.py | 13 |
4 files changed, 19 insertions, 8 deletions
diff --git a/tests/extmod/ujson_dumps.py b/tests/extmod/ujson_dumps.py index 16a695ab5..c0ee60d73 100644 --- a/tests/extmod/ujson_dumps.py +++ b/tests/extmod/ujson_dumps.py @@ -7,7 +7,6 @@ print(json.dumps(False)) print(json.dumps(True)) print(json.dumps(None)) print(json.dumps(1)) -print(json.dumps(1.2)) print(json.dumps('abc')) print(json.dumps('\x00\x01\x7e')) print(json.dumps([])) diff --git a/tests/extmod/ujson_dumps_float.py b/tests/extmod/ujson_dumps_float.py new file mode 100644 index 000000000..f6ba5f113 --- /dev/null +++ b/tests/extmod/ujson_dumps_float.py @@ -0,0 +1,6 @@ +try: + import ujson as json +except ImportError: + import json + +print(json.dumps(1.2)) diff --git a/tests/extmod/ujson_loads.py b/tests/extmod/ujson_loads.py index 75e61dacd..22f4a02c4 100644 --- a/tests/extmod/ujson_loads.py +++ b/tests/extmod/ujson_loads.py @@ -6,8 +6,6 @@ except: def my_print(o): if isinstance(o, dict): print('sorted dict', sorted(o.items())) - elif isinstance(o, float): - print('%.3f' % o) else: print(o) @@ -15,12 +13,7 @@ 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]')) diff --git a/tests/extmod/ujson_loads_float.py b/tests/extmod/ujson_loads_float.py new file mode 100644 index 000000000..f5e754608 --- /dev/null +++ b/tests/extmod/ujson_loads_float.py @@ -0,0 +1,13 @@ +try: + import ujson as json +except: + import json + +def my_print(o): + print('%.3f' % o) + +my_print(json.loads('1.2')) +my_print(json.loads('1e2')) +my_print(json.loads('-2.3')) +my_print(json.loads('-2e3')) +my_print(json.loads('-2e-3')) |
