summaryrefslogtreecommitdiff
path: root/tests/extmod/vfs_fat_fileio1.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extmod/vfs_fat_fileio1.py')
-rw-r--r--tests/extmod/vfs_fat_fileio1.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py
index 7fe040d53..e42911093 100644
--- a/tests/extmod/vfs_fat_fileio1.py
+++ b/tests/extmod/vfs_fat_fileio1.py
@@ -20,17 +20,17 @@ class RAMFS:
self.data = bytearray(blocks * self.SEC_SIZE)
def readblocks(self, n, buf):
- #print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
+ # print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
for i in range(len(buf)):
buf[i] = self.data[n * self.SEC_SIZE + i]
def writeblocks(self, n, buf):
- #print("writeblocks(%s, %x)" % (n, id(buf)))
+ # print("writeblocks(%s, %x)" % (n, id(buf)))
for i in range(len(buf)):
self.data[n * self.SEC_SIZE + i] = buf[i]
def ioctl(self, op, arg):
- #print("ioctl(%d, %r)" % (op, arg))
+ # print("ioctl(%d, %r)" % (op, arg))
if op == 4: # MP_BLOCKDEV_IOCTL_BLOCK_COUNT
return len(self.data) // self.SEC_SIZE
if op == 5: # MP_BLOCKDEV_IOCTL_BLOCK_SIZE
@@ -45,8 +45,8 @@ except MemoryError:
uos.VfsFat.mkfs(bdev)
vfs = uos.VfsFat(bdev)
-uos.mount(vfs, '/ramdisk')
-uos.chdir('/ramdisk')
+uos.mount(vfs, "/ramdisk")
+uos.chdir("/ramdisk")
# file IO
f = open("foo_file.txt", "w")
@@ -54,7 +54,7 @@ print(str(f)[:17], str(f)[-1:])
f.write("hello!")
f.flush()
f.close()
-f.close() # allowed
+f.close() # allowed
try:
f.write("world!")
except OSError as e:
@@ -82,21 +82,21 @@ with open("foo_file.txt") as f2:
print(f2.read())
print(f2.tell())
- f2.seek(0, 0) # SEEK_SET
+ f2.seek(0, 0) # SEEK_SET
print(f2.read(1))
- f2.seek(0, 1) # SEEK_CUR
+ f2.seek(0, 1) # SEEK_CUR
print(f2.read(1))
- f2.seek(2, 1) # SEEK_CUR
+ f2.seek(2, 1) # SEEK_CUR
print(f2.read(1))
- f2.seek(-2, 2) # SEEK_END
+ f2.seek(-2, 2) # SEEK_END
print(f2.read(1))
# using constructor of FileIO type to open a file
# no longer working with new VFS sub-system
-#FileIO = type(f)
-#with FileIO("/ramdisk/foo_file.txt") as f:
+# FileIO = type(f)
+# with FileIO("/ramdisk/foo_file.txt") as f:
# print(f.read())
# dirs
@@ -105,7 +105,7 @@ vfs.mkdir("foo_dir")
try:
vfs.rmdir("foo_file.txt")
except OSError as e:
- print(e.args[0] == 20) # uerrno.ENOTDIR
+ print(e.args[0] == 20) # uerrno.ENOTDIR
vfs.remove("foo_file.txt")
print(list(vfs.ilistdir()))