We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a63a476 commit 5bf6ebaCopy full SHA for 5bf6eba
1 file changed
tests/io/open_plus.py
@@ -0,0 +1,42 @@
1
+import sys
2
+try:
3
+ import uos as os
4
+except ImportError:
5
+ import os
6
+
7
+if not hasattr(os, "unlink"):
8
+ print("SKIP")
9
+ sys.exit()
10
11
+# cleanup in case testfile exists
12
13
+ os.unlink("testfile")
14
+except OSError:
15
+ pass
16
17
18
+ f = open("testfile", "r+b")
19
+ print("Unexpectedly opened non-existing file")
20
21
+ print("Expected OSError")
22
23
24
+f = open("testfile", "w+b")
25
+f.write(b"1234567890")
26
+f.seek(0)
27
+print(f.read())
28
+f.close()
29
30
+# Open with truncation
31
32
+f.write(b"abcdefg")
33
34
35
36
37
+# Open without truncation
38
+f = open("testfile", "r+b")
39
+f.write(b"1234")
40
41
42
0 commit comments