Skip to content
Snippets Groups Projects
Commit e44c1d3a authored by Damien George's avatar Damien George
Browse files

tests: Split out json float tests to separate files.

parent 186b355b
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,6 @@ print(json.dumps(False)) ...@@ -7,7 +7,6 @@ print(json.dumps(False))
print(json.dumps(True)) print(json.dumps(True))
print(json.dumps(None)) print(json.dumps(None))
print(json.dumps(1)) print(json.dumps(1))
print(json.dumps(1.2))
print(json.dumps('abc')) print(json.dumps('abc'))
print(json.dumps('\x00\x01\x7e')) print(json.dumps('\x00\x01\x7e'))
print(json.dumps([])) print(json.dumps([]))
......
try:
import ujson as json
except ImportError:
import json
print(json.dumps(1.2))
...@@ -6,8 +6,6 @@ except: ...@@ -6,8 +6,6 @@ except:
def my_print(o): def my_print(o):
if isinstance(o, dict): if isinstance(o, dict):
print('sorted dict', sorted(o.items())) print('sorted dict', sorted(o.items()))
elif isinstance(o, float):
print('%.3f' % o)
else: else:
print(o) print(o)
...@@ -15,12 +13,7 @@ my_print(json.loads('null')) ...@@ -15,12 +13,7 @@ my_print(json.loads('null'))
my_print(json.loads('false')) my_print(json.loads('false'))
my_print(json.loads('true')) my_print(json.loads('true'))
my_print(json.loads('1')) 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'))
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('"abc\\u0064e"'))
my_print(json.loads('[]')) my_print(json.loads('[]'))
my_print(json.loads('[null]')) my_print(json.loads('[null]'))
......
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'))
...@@ -155,8 +155,8 @@ def run_tests(pyb, tests, args): ...@@ -155,8 +155,8 @@ def run_tests(pyb, tests, args):
skip_tests.add('misc/rge_sm.py') # requires floating point 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.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/zlibd_decompress.py') # requires zlib
skip_tests.add('extmod/ujson_dumps.py') # requires floating point skip_tests.add('extmod/ujson_dumps_float.py') # requires floating point
skip_tests.add('extmod/ujson_loads.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 # Some tests are known to fail on 64-bit machines
if pyb is None and platform.architecture()[0] == '64bit': if pyb is None and platform.architecture()[0] == '64bit':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment