aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/io/file_readinto_len.py10
-rw-r--r--tests/io/file_readinto_len.py.exp4
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/io/file_readinto_len.py b/tests/io/file_readinto_len.py
new file mode 100644
index 000000000..84cc8cf5e
--- /dev/null
+++ b/tests/io/file_readinto_len.py
@@ -0,0 +1,10 @@
+b = bytearray(30)
+f = open("io/data/file1", "rb")
+# 2nd arg (length to read) is extension to CPython
+print(f.readinto(b, 8))
+print(b)
+
+b = bytearray(4)
+f = open("io/data/file1", "rb")
+print(f.readinto(b, 8))
+print(b)
diff --git a/tests/io/file_readinto_len.py.exp b/tests/io/file_readinto_len.py.exp
new file mode 100644
index 000000000..a7877115e
--- /dev/null
+++ b/tests/io/file_readinto_len.py.exp
@@ -0,0 +1,4 @@
+8
+bytearray(b'longer l\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
+4
+bytearray(b'long')