circuitpython/tests/extmod/ujson_loads_float.py

20 lines
337 B
Python
Raw Normal View History

try:
import ujson as json
2017-02-14 17:56:22 -05:00
except ImportError:
try:
import json
except ImportError:
print("SKIP")
raise SystemExit
2021-03-15 09:57:36 -04:00
def my_print(o):
2021-03-15 09:57:36 -04:00
print("%.3f" % o)
2021-03-15 09:57:36 -04:00
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"))