Skip to content

Commit ca7dd49

Browse files
committed
add test_builtin_open
1 parent 6f8b65f commit ca7dd49

File tree

1 file changed

+21
-2
lines changed
  • graalpython/com.oracle.graal.python.test/src/tests

1 file changed

+21
-2
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_pyio.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def unlink(file_name):
5454

5555

5656
def test_read_write_file():
57-
import _pyio as pyio # Python implementation.
57+
import _pyio as pyio # Python implementation.
5858

5959
file_name = "dump.txt"
6060

@@ -88,7 +88,7 @@ def try_one(s):
8888

8989

9090
def test_file():
91-
import _pyio as pyio # Python implementation.
91+
import _pyio as pyio # Python implementation.
9292
file_name = "dump.txt"
9393

9494
unlink(file_name)
@@ -153,3 +153,22 @@ class NonString:
153153
assert f.closed
154154
finally:
155155
unlink(file_name)
156+
157+
158+
def test_builtin_open():
159+
import _pyio as pyio # Python implementation.
160+
file_name = "mymodule.py"
161+
162+
f = pyio.open(file_name, "w")
163+
f.write('print(42)\n')
164+
f.close()
165+
166+
success = True
167+
try:
168+
exec(open(file_name).read())
169+
exec(compile(open(file_name, "r").read(), file_name, "eval"))
170+
except Exception as e:
171+
print(e)
172+
success = False
173+
174+
assert success

0 commit comments

Comments
 (0)