Logo
Explore Help
Register Sign In
fengqi/lv_micropython
1
0
Fork 0
You've already forked lv_micropython
Code Issues Pull Requests 1 Actions Packages Projects Releases Wiki Activity
lv_micropython/tests/extmod/ujson_dumps_float.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
205 B
Python
Raw Normal View History

tests: Split out json float tests to separate files.
2015-06-25 10:50:00 +01:00
try:
import ujson as json
except ImportError:
tests/extmod: Make tests skippable.
2017-02-15 01:56:22 +03:00
try:
import json
except ImportError:
print("SKIP")
tests: Convert remaining "sys.exit()" to "raise SystemExit".
2017-06-10 20:14:16 +03:00
raise SystemExit
tests: Split out json float tests to separate files.
2015-06-25 10:50:00 +01:00
print(json.dumps(1.2))
py/objdict: Quote non-string types when used as keys in JSON output. JSON requires that keys of objects be strings. CPython will therefore automatically quote simple types (NoneType, bool, int, float) when they are used directly as keys in JSON output. To prevent subtle bugs and emit compliant JSON, MicroPython should at least test for such keys so they aren't silently let through. Then doing the actual quoting is a similar cost to raising an exception, so that's what is implemented by this patch. Fixes issue #4790.
2019-07-16 14:29:22 -07:00
print(json.dumps({1.5: "hi"}))
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.23.8 Page: 131ms Template: 1ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API