summaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-04-07 09:03:33 +0100
committerDamien George <damien.p.george@gmail.com>2016-04-07 09:03:33 +0100
commit04d5e644fcf4e0171383403e69d8fff429bba425 (patch)
treeee41dfcdc84dac347ce3acf1264c45fbaaf5537c /tests
parent2c915e1ae61785ab6e33189581fb353ebd40d0ca (diff)
downloadmicropython-04d5e644fcf4e0171383403e69d8fff429bba425.tar.gz
micropython-04d5e644fcf4e0171383403e69d8fff429bba425.zip
py/objarray: Fix array.append so it doesn't extend if append fails.
Addresses issue #1965.
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/bytearray_append.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/basics/bytearray_append.py b/tests/basics/bytearray_append.py
new file mode 100644
index 0000000000..06e62c6bcb
--- /dev/null
+++ b/tests/basics/bytearray_append.py
@@ -0,0 +1,15 @@
+# test bytearray.append method
+
+a = bytearray(4)
+print(a)
+
+# append should append a single byte
+a.append(2)
+print(a)
+
+# a should not be modified if append fails
+try:
+ a.append(None)
+except TypeError:
+ print('TypeError')
+print(a)