summaryrefslogtreecommitdiff
path: root/tests/io
diff options
context:
space:
mode:
Diffstat (limited to 'tests/io')
-rw-r--r--tests/io/argv.py1
-rw-r--r--tests/io/buffered_writer.py2
-rw-r--r--tests/io/builtin_print_file.py8
-rw-r--r--tests/io/file1.py26
-rw-r--r--tests/io/file_readinto.py4
-rw-r--r--tests/io/file_readline.py4
-rw-r--r--tests/io/file_seek.py4
-rw-r--r--tests/io/file_with.py2
-rw-r--r--tests/io/iobase.py7
-rw-r--r--tests/io/resource_stream.py2
-rw-r--r--tests/io/stringio1.py4
-rw-r--r--tests/io/write_ext.py2
12 files changed, 34 insertions, 32 deletions
diff --git a/tests/io/argv.py b/tests/io/argv.py
index a13f2cad2..53254da11 100644
--- a/tests/io/argv.py
+++ b/tests/io/argv.py
@@ -1,2 +1,3 @@
import sys
+
print(sys.argv)
diff --git a/tests/io/buffered_writer.py b/tests/io/buffered_writer.py
index c2cedb991..64e5fa1ee 100644
--- a/tests/io/buffered_writer.py
+++ b/tests/io/buffered_writer.py
@@ -4,7 +4,7 @@ try:
io.BytesIO
io.BufferedWriter
except AttributeError:
- print('SKIP')
+ print("SKIP")
raise SystemExit
bts = io.BytesIO()
diff --git a/tests/io/builtin_print_file.py b/tests/io/builtin_print_file.py
index d9b8e2a96..822356a6c 100644
--- a/tests/io/builtin_print_file.py
+++ b/tests/io/builtin_print_file.py
@@ -5,13 +5,13 @@ import sys
try:
sys.stdout
except AttributeError:
- print('SKIP')
+ print("SKIP")
raise SystemExit
print(file=sys.stdout)
-print('test', file=sys.stdout)
+print("test", file=sys.stdout)
try:
print(file=1)
-except (AttributeError, OSError): # CPython and uPy differ in error message
- print('Error')
+except (AttributeError, OSError): # CPython and uPy differ in error message
+ print("Error")
diff --git a/tests/io/file1.py b/tests/io/file1.py
index af4176b64..2a46c9c63 100644
--- a/tests/io/file1.py
+++ b/tests/io/file1.py
@@ -4,43 +4,43 @@ print(f.readline())
print(f.read())
f = open("io/data/file1")
print(f.readlines())
-f = open("io/data/file1","r")
+f = open("io/data/file1", "r")
print(f.readlines())
-f = open("io/data/file1","rb")
+f = open("io/data/file1", "rb")
print(f.readlines())
-f = open("io/data/file1",mode="r")
+f = open("io/data/file1", mode="r")
print(f.readlines())
-f = open("io/data/file1",mode="rb")
+f = open("io/data/file1", mode="rb")
print(f.readlines())
# write() error
-f = open('io/data/file1', 'r')
+f = open("io/data/file1", "r")
try:
- f.write('x')
+ f.write("x")
except OSError:
- print('OSError')
+ print("OSError")
f.close()
# read(n) error on binary file
-f = open('io/data/file1', 'ab')
+f = open("io/data/file1", "ab")
try:
f.read(1)
except OSError:
- print('OSError')
+ print("OSError")
f.close()
# read(n) error on text file
-f = open('io/data/file1', 'at')
+f = open("io/data/file1", "at")
try:
f.read(1)
except OSError:
- print('OSError')
+ print("OSError")
f.close()
# read() w/o args error
-f = open('io/data/file1', 'ab')
+f = open("io/data/file1", "ab")
try:
f.read()
except OSError:
- print('OSError')
+ print("OSError")
f.close()
diff --git a/tests/io/file_readinto.py b/tests/io/file_readinto.py
index cbefc6e04..1f3702a21 100644
--- a/tests/io/file_readinto.py
+++ b/tests/io/file_readinto.py
@@ -7,8 +7,8 @@ print(f.readinto(b))
print(b)
# readinto() on writable file
-f = open('io/data/file1', 'ab')
+f = open("io/data/file1", "ab")
try:
f.readinto(bytearray(4))
except OSError:
- print('OSError')
+ print("OSError")
diff --git a/tests/io/file_readline.py b/tests/io/file_readline.py
index 25e76597b..86d010eaf 100644
--- a/tests/io/file_readline.py
+++ b/tests/io/file_readline.py
@@ -6,9 +6,9 @@ print(f.readline(5))
print(f.readline())
# readline() on writable file
-f = open('io/data/file1', 'ab')
+f = open("io/data/file1", "ab")
try:
f.readline()
except OSError:
- print('OSError')
+ print("OSError")
f.close()
diff --git a/tests/io/file_seek.py b/tests/io/file_seek.py
index 10fb1fd06..2fe57692c 100644
--- a/tests/io/file_seek.py
+++ b/tests/io/file_seek.py
@@ -25,10 +25,10 @@ print(f.tell())
f.close()
# seek closed file
-f = open('io/data/file1', 'r')
+f = open("io/data/file1", "r")
f.close()
try:
f.seek(1)
except (OSError, ValueError):
# CPy raises ValueError, uPy raises OSError
- print('OSError or ValueError')
+ print("OSError or ValueError")
diff --git a/tests/io/file_with.py b/tests/io/file_with.py
index ee1e70242..899c0f928 100644
--- a/tests/io/file_with.py
+++ b/tests/io/file_with.py
@@ -15,7 +15,7 @@ except:
# Regression test: test that exception in with initialization properly
# thrown and doesn't crash.
try:
- with open('__non_existent', 'r'):
+ with open("__non_existent", "r"):
pass
except OSError:
print("OSError")
diff --git a/tests/io/iobase.py b/tests/io/iobase.py
index 6f554b00f..667e62985 100644
--- a/tests/io/iobase.py
+++ b/tests/io/iobase.py
@@ -6,14 +6,15 @@ except:
try:
io.IOBase
except AttributeError:
- print('SKIP')
+ print("SKIP")
raise SystemExit
class MyIO(io.IOBase):
def write(self, buf):
# CPython and uPy pass in different types for buf (str vs bytearray)
- print('write', len(buf))
+ print("write", len(buf))
return len(buf)
-print('test', file=MyIO())
+
+print("test", file=MyIO())
diff --git a/tests/io/resource_stream.py b/tests/io/resource_stream.py
index 37d985bf1..5656205b6 100644
--- a/tests/io/resource_stream.py
+++ b/tests/io/resource_stream.py
@@ -4,7 +4,7 @@ import sys
try:
uio.resource_stream
except AttributeError:
- print('SKIP')
+ print("SKIP")
raise SystemExit
buf = uio.resource_stream("data", "file2")
diff --git a/tests/io/stringio1.py b/tests/io/stringio1.py
index 9f7c1e44e..6d8491754 100644
--- a/tests/io/stringio1.py
+++ b/tests/io/stringio1.py
@@ -4,7 +4,7 @@ except ImportError:
import io
a = io.StringIO()
-print('io.StringIO' in repr(a))
+print("io.StringIO" in repr(a))
print(a.getvalue())
print(a.read())
@@ -35,7 +35,7 @@ print(a.read())
a = io.StringIO()
a.close()
-for f in [a.read, a.getvalue, lambda:a.write("")]:
+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:
diff --git a/tests/io/write_ext.py b/tests/io/write_ext.py
index 5a6eaa35c..18cd75ddb 100644
--- a/tests/io/write_ext.py
+++ b/tests/io/write_ext.py
@@ -5,7 +5,7 @@ import uio
try:
uio.BytesIO
except AttributeError:
- print('SKIP')
+ print("SKIP")
raise SystemExit
buf = uio.BytesIO()