summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/ujson_load_readinto.py22
-rw-r--r--tests/extmod/ujson_load_readinto.py.exp4
-rw-r--r--tests/skip_if.py23
-rw-r--r--tests/thread/mutate_bytearray.py4
-rw-r--r--tests/thread/mutate_dict.py4
-rw-r--r--tests/thread/mutate_instance.py4
-rw-r--r--tests/thread/mutate_list.py4
-rw-r--r--tests/thread/mutate_set.py4
-rw-r--r--tests/thread/stress_aes.py4
-rw-r--r--tests/thread/stress_heap.py4
-rw-r--r--tests/thread/stress_recurse.py4
-rw-r--r--tests/thread/thread_exc1.py4
-rw-r--r--tests/thread/thread_exit1.py4
-rw-r--r--tests/thread/thread_exit2.py4
-rw-r--r--tests/thread/thread_gc1.py4
-rw-r--r--tests/thread/thread_ident1.py4
-rw-r--r--tests/thread/thread_lock1.py4
-rw-r--r--tests/thread/thread_lock2.py4
-rw-r--r--tests/thread/thread_lock3.py4
-rw-r--r--tests/thread/thread_lock4.py4
-rw-r--r--tests/thread/thread_qstr1.py4
-rw-r--r--tests/thread/thread_shared1.py4
-rw-r--r--tests/thread/thread_shared2.py4
-rw-r--r--tests/thread/thread_sleep1.py4
-rw-r--r--tests/thread/thread_stacksize1.py4
-rw-r--r--tests/thread/thread_start1.py4
-rw-r--r--tests/thread/thread_start2.py4
27 files changed, 101 insertions, 44 deletions
diff --git a/tests/extmod/ujson_load_readinto.py b/tests/extmod/ujson_load_readinto.py
new file mode 100644
index 000000000..a277f40ef
--- /dev/null
+++ b/tests/extmod/ujson_load_readinto.py
@@ -0,0 +1,22 @@
+import ujson as json
+
+# Test that json can load from any object with readinto
+
+class Buffer:
+ def __init__(self, data):
+ self._data = data
+ self._i = 0
+
+ def readinto(self, buf):
+ end = self._i + len(buf)
+ remaining = len(self._data) - self._i
+ end = min(end, len(self._data))
+ l = min(len(buf), remaining)
+ buf[:l] = self._data[self._i:end]
+ self._i += l
+ return l
+
+print(json.load(Buffer(b'null')))
+print(json.load(Buffer(b'"abc\\u0064e"')))
+print(json.load(Buffer(b'[false, true, 1, -2]')))
+print(json.load(Buffer(b'{"a":true}')))
diff --git a/tests/extmod/ujson_load_readinto.py.exp b/tests/extmod/ujson_load_readinto.py.exp
new file mode 100644
index 000000000..f8c3c693b
--- /dev/null
+++ b/tests/extmod/ujson_load_readinto.py.exp
@@ -0,0 +1,4 @@
+None
+abcde
+[False, True, 1, -2]
+{'a': True}
diff --git a/tests/skip_if.py b/tests/skip_if.py
index 7d6c5b207..a8f50c465 100644
--- a/tests/skip_if.py
+++ b/tests/skip_if.py
@@ -1,24 +1,7 @@
-# The MIT License (MIT)
+# SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
#
-# Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
+# SPDX-License-Identifier: MIT
# This must be on one line so its skipped when built into tests.
"""This file provides helpers to detect particular running conditions and skip the test when appropriate."""
diff --git a/tests/thread/mutate_bytearray.py b/tests/thread/mutate_bytearray.py
index f91b2d580..5015c3f9c 100644
--- a/tests/thread/mutate_bytearray.py
+++ b/tests/thread/mutate_bytearray.py
@@ -1,6 +1,8 @@
# test concurrent mutating access to a shared bytearray object
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/mutate_dict.py b/tests/thread/mutate_dict.py
index c57d332d5..563fce39d 100644
--- a/tests/thread/mutate_dict.py
+++ b/tests/thread/mutate_dict.py
@@ -1,6 +1,8 @@
# test concurrent mutating access to a shared dict object
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/mutate_instance.py b/tests/thread/mutate_instance.py
index a1ae428b5..2ecfbe109 100644
--- a/tests/thread/mutate_instance.py
+++ b/tests/thread/mutate_instance.py
@@ -1,6 +1,8 @@
# test concurrent mutating access to a shared user instance
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/mutate_list.py b/tests/thread/mutate_list.py
index 764a9bd99..d70e8a8a3 100644
--- a/tests/thread/mutate_list.py
+++ b/tests/thread/mutate_list.py
@@ -1,6 +1,8 @@
# test concurrent mutating access to a shared list object
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/mutate_set.py b/tests/thread/mutate_set.py
index 5492d8631..c4529f356 100644
--- a/tests/thread/mutate_set.py
+++ b/tests/thread/mutate_set.py
@@ -1,6 +1,8 @@
# test concurrent mutating access to a shared set object
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py
index df75e616c..ebf7af371 100644
--- a/tests/thread/stress_aes.py
+++ b/tests/thread/stress_aes.py
@@ -11,7 +11,9 @@
# aggressive by changing the amount of data to encrypt, the number of loops and
# the number of threads.
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
##################################################################
# discrete arithmetic routines, mostly from a precomputed table
diff --git a/tests/thread/stress_heap.py b/tests/thread/stress_heap.py
index 5482a9ac6..206cf1a86 100644
--- a/tests/thread/stress_heap.py
+++ b/tests/thread/stress_heap.py
@@ -1,7 +1,9 @@
# stress test for the heap by allocating lots of objects within threads
# allocates about 5mb on the heap
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime as time
diff --git a/tests/thread/stress_recurse.py b/tests/thread/stress_recurse.py
index 68367c4dd..8edee246a 100644
--- a/tests/thread/stress_recurse.py
+++ b/tests/thread/stress_recurse.py
@@ -1,6 +1,8 @@
# test hitting the function recursion limit within a thread
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/thread_exc1.py b/tests/thread/thread_exc1.py
index 10fb94b4f..e00a16bd2 100644
--- a/tests/thread/thread_exc1.py
+++ b/tests/thread/thread_exc1.py
@@ -1,6 +1,8 @@
# test raising and catching an exception within a thread
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/thread_exit1.py b/tests/thread/thread_exit1.py
index 88cdd165c..ad7b01d89 100644
--- a/tests/thread/thread_exit1.py
+++ b/tests/thread/thread_exit1.py
@@ -1,6 +1,8 @@
# test _thread.exit() function
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime as time
diff --git a/tests/thread/thread_exit2.py b/tests/thread/thread_exit2.py
index 368a11bba..6bff8a173 100644
--- a/tests/thread/thread_exit2.py
+++ b/tests/thread/thread_exit2.py
@@ -1,6 +1,8 @@
# test raising SystemExit to finish a thread
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime as time
diff --git a/tests/thread/thread_gc1.py b/tests/thread/thread_gc1.py
index 8dcbf7e07..2ea189161 100644
--- a/tests/thread/thread_gc1.py
+++ b/tests/thread/thread_gc1.py
@@ -1,6 +1,8 @@
# test that we can run the garbage collector within threads
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import gc
import _thread
diff --git a/tests/thread/thread_ident1.py b/tests/thread/thread_ident1.py
index 217fce73b..9a6f89ff5 100644
--- a/tests/thread/thread_ident1.py
+++ b/tests/thread/thread_ident1.py
@@ -1,6 +1,8 @@
# test _thread.get_ident() function
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/thread_lock1.py b/tests/thread/thread_lock1.py
index ba5c7dff0..c2d7c9d1e 100644
--- a/tests/thread/thread_lock1.py
+++ b/tests/thread/thread_lock1.py
@@ -1,6 +1,8 @@
# test _thread lock object using a single thread
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/thread_lock2.py b/tests/thread/thread_lock2.py
index 405f10b0b..4ef912dff 100644
--- a/tests/thread/thread_lock2.py
+++ b/tests/thread/thread_lock2.py
@@ -1,6 +1,8 @@
# test _thread lock objects with multiple threads
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime as time
diff --git a/tests/thread/thread_lock3.py b/tests/thread/thread_lock3.py
index 607898dad..35808d99c 100644
--- a/tests/thread/thread_lock3.py
+++ b/tests/thread/thread_lock3.py
@@ -1,6 +1,8 @@
# test thread coordination using a lock object
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/thread_lock4.py b/tests/thread/thread_lock4.py
index 2f9d42d6b..440f3e90c 100644
--- a/tests/thread/thread_lock4.py
+++ b/tests/thread/thread_lock4.py
@@ -1,6 +1,8 @@
# test using lock to coordinate access to global mutable objects
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime as time
diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py
index f4136d964..dccfb7f51 100644
--- a/tests/thread/thread_qstr1.py
+++ b/tests/thread/thread_qstr1.py
@@ -1,6 +1,8 @@
# test concurrent interning of strings
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime as time
diff --git a/tests/thread/thread_shared1.py b/tests/thread/thread_shared1.py
index 13c6651cc..de339ad7f 100644
--- a/tests/thread/thread_shared1.py
+++ b/tests/thread/thread_shared1.py
@@ -1,6 +1,8 @@
# test capability for threads to access a shared immutable data structure
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/thread_shared2.py b/tests/thread/thread_shared2.py
index e4bfe7802..2c749e688 100644
--- a/tests/thread/thread_shared2.py
+++ b/tests/thread/thread_shared2.py
@@ -1,7 +1,9 @@
# test capability for threads to access a shared mutable data structure
# (without contention because they access different parts of the structure)
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import _thread
diff --git a/tests/thread/thread_sleep1.py b/tests/thread/thread_sleep1.py
index 032ec1754..d5aa99f97 100644
--- a/tests/thread/thread_sleep1.py
+++ b/tests/thread/thread_sleep1.py
@@ -1,6 +1,8 @@
# test threads sleeping
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime
diff --git a/tests/thread/thread_stacksize1.py b/tests/thread/thread_stacksize1.py
index 62b6e5e40..e7189fafb 100644
--- a/tests/thread/thread_stacksize1.py
+++ b/tests/thread/thread_stacksize1.py
@@ -1,6 +1,8 @@
# test setting the thread stack size
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
import sys
import _thread
diff --git a/tests/thread/thread_start1.py b/tests/thread/thread_start1.py
index d23a74aa2..94df6dc62 100644
--- a/tests/thread/thread_start1.py
+++ b/tests/thread/thread_start1.py
@@ -1,6 +1,8 @@
# test basic capability to start a new thread
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime as time
diff --git a/tests/thread/thread_start2.py b/tests/thread/thread_start2.py
index d0913e37c..9412bb618 100644
--- a/tests/thread/thread_start2.py
+++ b/tests/thread/thread_start2.py
@@ -1,6 +1,8 @@
# test capability to start a thread with keyword args
#
-# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+# SPDX-FileCopyrightText: Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
+#
+# SPDX-License-Identifier: MIT
try:
import utime as time