aboutsummaryrefslogtreecommitdiff
path: root/tests/io
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-10-18 22:44:07 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-10-18 22:44:07 +0300
commit1a55b6a787ee7a568550ac0510632965af61c9ee (patch)
tree61f49937226e3dfb945adecef74cc1eff3dfc57e /tests/io
parentc92672d7f8fc410477a4e25789d15c1fd99b675b (diff)
unix, stmhal: Implement file.readinto() method.
Also, usocket.readinto(). Known issue is that .readinto() should be available only for binary files, but micropython uses single method table for both binary and text files.
Diffstat (limited to 'tests/io')
-rw-r--r--tests/io/data/file21
-rw-r--r--tests/io/file_readinto.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/tests/io/data/file2 b/tests/io/data/file2
new file mode 100644
index 000000000..274c0052d
--- /dev/null
+++ b/tests/io/data/file2
@@ -0,0 +1 @@
+1234 \ No newline at end of file
diff --git a/tests/io/file_readinto.py b/tests/io/file_readinto.py
new file mode 100644
index 000000000..7a0603377
--- /dev/null
+++ b/tests/io/file_readinto.py
@@ -0,0 +1,7 @@
+b = bytearray(30)
+f = open("io/data/file1", "rb")
+print(f.readinto(b))
+print(b)
+f = open("io/data/file2", "rb")
+print(f.readinto(b))
+print(b)