summaryrefslogtreecommitdiffstatshomepage
path: root/tests/io/file-with.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/io/file-with.py')
-rw-r--r--tests/io/file-with.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/io/file-with.py b/tests/io/file-with.py
new file mode 100644
index 0000000000..2350721641
--- /dev/null
+++ b/tests/io/file-with.py
@@ -0,0 +1,12 @@
+f = open("io/data/file1")
+
+with f as f2:
+ print(f2.read())
+
+# File should be closed
+try:
+ f.read()
+except:
+ # Note: CPython and us throw different exception trying to read from
+ # close file.
+ print("can't read file after with")