diff --git a/tests/extmod/ujson_loads.py b/tests/extmod/ujson_loads.py index 43672d6505de40cf9f5691297aece56836a47587..adba3c068d27c42616501604a81caa74b4464c2e 100644 --- a/tests/extmod/ujson_loads.py +++ b/tests/extmod/ujson_loads.py @@ -37,10 +37,6 @@ my_print(json.loads('"abc\\uabcd"')) # whitespace handling my_print(json.loads('{\n\t"a":[]\r\n, "b":[1], "c":{"3":4} \n\r\t\r\r\r\n}')) -# loading from bytes and bytearray -my_print(json.loads(b'[1,2]')) -my_print(json.loads(bytearray(b'[null]'))) - # loading nothing should raise exception try: json.loads('') diff --git a/tests/extmod/ujson_loads_bytes.py b/tests/extmod/ujson_loads_bytes.py new file mode 100644 index 0000000000000000000000000000000000000000..507e4ca885b7b3003ae8282d31b69df9d7ff83f9 --- /dev/null +++ b/tests/extmod/ujson_loads_bytes.py @@ -0,0 +1,13 @@ +# test loading from bytes and bytearray (introduced in Python 3.6) + +try: + import ujson as json +except ImportError: + try: + import json + except ImportError: + print("SKIP") + raise SystemExit + +print(json.loads(b'[1,2]')) +print(json.loads(bytearray(b'[null]'))) diff --git a/tests/extmod/ujson_loads_bytes.py.exp b/tests/extmod/ujson_loads_bytes.py.exp new file mode 100644 index 0000000000000000000000000000000000000000..c2735a99052d276c11d5ede2ac5a89aa70fc3f85 --- /dev/null +++ b/tests/extmod/ujson_loads_bytes.py.exp @@ -0,0 +1,2 @@ +[1, 2] +[None]