summaryrefslogtreecommitdiffstatshomepage
path: root/tests/io/open_append.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-06-21 00:02:41 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-06-21 00:05:09 +0300
commita06c38b486264477e2dd741badd4a2936e80299f (patch)
tree38330a029ffeac59383a0747ae294ea1634164f2 /tests/io/open_append.py
parent63b9e598a35e19ea87ea9de7831ec4fde75def8c (diff)
downloadmicropython-a06c38b486264477e2dd741badd4a2936e80299f.tar.gz
micropython-a06c38b486264477e2dd741badd4a2936e80299f.zip
tests: Add testcase for open(..., "a").
Diffstat (limited to 'tests/io/open_append.py')
-rw-r--r--tests/io/open_append.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/io/open_append.py b/tests/io/open_append.py
new file mode 100644
index 0000000000..fb76d09c42
--- /dev/null
+++ b/tests/io/open_append.py
@@ -0,0 +1,31 @@
+import sys
+try:
+ import _os as os
+except ImportError:
+ import os
+
+if not hasattr(os, "unlink"):
+ print("SKIP")
+ sys.exit()
+
+try:
+ os.unlink("testfile")
+except OSError:
+ pass
+
+# Should create a file
+f = open("testfile", "a")
+f.write("foo")
+f.close()
+
+f = open("testfile")
+print(f.read())
+f.close()
+
+f = open("testfile", "a")
+f.write("bar")
+f.close()
+
+f = open("testfile")
+print(f.read())
+f.close()