summaryrefslogtreecommitdiffstatshomepage
path: root/tests/io/stringio1.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/io/stringio1.py')
-rw-r--r--tests/io/stringio1.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/io/stringio1.py b/tests/io/stringio1.py
index 6979fe7c9d..dae0187f88 100644
--- a/tests/io/stringio1.py
+++ b/tests/io/stringio1.py
@@ -28,3 +28,14 @@ print(a.getvalue())
a = io.StringIO()
a.write("foo")
print(a.read())
+
+a = io.StringIO()
+a.close()
+for f in [a.read, a.getvalue, lambda:a.write("")]:
+ # CPython throws for operations on closed I/O, micropython makes
+ # the underlying string empty unless MICROPY_CPYTHON_COMPAT defined
+ try:
+ f()
+ print("ValueError")
+ except ValueError:
+ print("ValueError")