Skip to content

Commit a06c38b

Browse files
committed
tests: Add testcase for open(..., "a").
1 parent 63b9e59 commit a06c38b

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

tests/io/open_append.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import sys
2+
try:
3+
import _os as os
4+
except ImportError:
5+
import os
6+
7+
if not hasattr(os, "unlink"):
8+
print("SKIP")
9+
sys.exit()
10+
11+
try:
12+
os.unlink("testfile")
13+
except OSError:
14+
pass
15+
16+
# Should create a file
17+
f = open("testfile", "a")
18+
f.write("foo")
19+
f.close()
20+
21+
f = open("testfile")
22+
print(f.read())
23+
f.close()
24+
25+
f = open("testfile", "a")
26+
f.write("bar")
27+
f.close()
28+
29+
f = open("testfile")
30+
print(f.read())
31+
f.close()

0 commit comments

Comments
 (0)