diff options
| author | Damien George | 2014-09-17 22:56:34 +0100 |
|---|---|---|
| committer | Damien George | 2014-09-17 22:56:34 +0100 |
| commit | 612045f53f7e5edf9faa359ee9ee52d490d58000 (patch) | |
| tree | a021612e31ff6275246514405c4a8421c6eff5d7 /tests | |
| parent | 8a9b999f1c9a0edf84b2507940efb8deaaa380b8 (diff) | |
py: Add native json printing using existing print framework.
Also add start of ujson module with dumps implemented. Enabled in unix
and stmhal ports. Test passes on both.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/extmod/ujson_dumps.py | 23 | ||||
| -rwxr-xr-x | tests/run-tests | 10 |
2 files changed, 31 insertions, 2 deletions
diff --git a/tests/extmod/ujson_dumps.py b/tests/extmod/ujson_dumps.py new file mode 100644 index 000000000..6e858fd3f --- /dev/null +++ b/tests/extmod/ujson_dumps.py @@ -0,0 +1,23 @@ +try: + import ujson as json +except ImportError: + import json + +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('\x01\x7e\x7f\x80\u1234')) +print(json.dumps([])) +print(json.dumps([1])) +print(json.dumps([1, 2])) +print(json.dumps([1, True])) +print(json.dumps(())) +print(json.dumps((1,))) +print(json.dumps((1, 2))) +print(json.dumps((1, (2, 3)))) +print(json.dumps({})) +print(json.dumps({"a":1})) +print(json.dumps({"a":(2,[3,None])})) diff --git a/tests/run-tests b/tests/run-tests index 34f855d08..a96f3773e 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -3,6 +3,7 @@ import os import subprocess import sys +import platform import argparse from glob import glob @@ -37,6 +38,11 @@ def run_tests(pyb, tests, args): if pyb is not None: skip_tests.add('float/float_divmod.py') # tested by float/float_divmod_relaxed.py instead + # Some tests are known to fail on 64-bit machines + if pyb is None and platform.architecture()[0] == '64bit': + skip_tests.add('extmod/uctypes_ptr_le.py') + skip_tests.add('extmod/uctypes_ptr_native_le.py') + # Some tests are known to fail with native emitter # Remove them from the below when they work if args.emit == 'native': @@ -153,10 +159,10 @@ def main(): if args.test_dirs is None: if pyb is None: # run PC tests - test_dirs = ('basics', 'micropython', 'float', 'import', 'io', 'misc', 'unicode', 'unix') + test_dirs = ('basics', 'micropython', 'float', 'import', 'io', 'misc', 'unicode', 'extmod', 'unix') else: # run pyboard tests - test_dirs = ('basics', 'micropython', 'float', 'misc', 'pyb', 'pybnative', 'inlineasm') + test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod', 'pyb', 'pybnative', 'inlineasm') else: # run tests from these directories test_dirs = args.test_dirs |
