diff options
author | Damien George <damien.p.george@gmail.com> | 2015-06-25 10:50:00 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-06-25 10:50:00 +0100 |
commit | e44c1d3acef6d1a81e9496d1a4a8c4d12e2fd0a6 (patch) | |
tree | 4e52070b638ed299323e9ee0f9a151740e1da06e | |
parent | 186b355b286d00a46b3eb1db6341c17763f30f10 (diff) |
tests: Split out json float tests to separate files.
-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 | ||||
-rwxr-xr-x | tests/run-tests | 4 |
5 files changed, 21 insertions, 10 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')) diff --git a/tests/run-tests b/tests/run-tests index c4868b3c2..bd2cbfd02 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -155,8 +155,8 @@ def run_tests(pyb, tests, args): skip_tests.add('misc/rge_sm.py') # requires floating point skip_tests.update({'extmod/uctypes_%s.py' % t for t in 'bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native'.split()}) # requires uctypes skip_tests.add('extmod/zlibd_decompress.py') # requires zlib - skip_tests.add('extmod/ujson_dumps.py') # requires floating point - skip_tests.add('extmod/ujson_loads.py') # requires floating point + skip_tests.add('extmod/ujson_dumps_float.py') # requires floating point + skip_tests.add('extmod/ujson_loads_float.py') # requires floating point # Some tests are known to fail on 64-bit machines if pyb is None and platform.architecture()[0] == '64bit': |