From 6194336d81e73e74eb7e0f26501966082ce4d411 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 2 Dec 2016 15:37:58 +1100 Subject: [PATCH] tests/extmod/vfs_fat_fileio: Add test for constructor of FileIO type. --- tests/extmod/vfs_fat_fileio.py | 5 +++++ tests/extmod/vfs_fat_fileio.py.exp | 1 + 2 files changed, 6 insertions(+) diff --git a/tests/extmod/vfs_fat_fileio.py b/tests/extmod/vfs_fat_fileio.py index 4e0dc60194..f050d94e27 100644 --- a/tests/extmod/vfs_fat_fileio.py +++ b/tests/extmod/vfs_fat_fileio.py @@ -89,6 +89,11 @@ with vfs.open("foo_file.txt") as f2: f2.seek(-2, 2) # SEEK_END print(f2.read(1)) +# using constructor of FileIO type to open a file +FileIO = type(f) +with FileIO("foo_file.txt") as f: + print(f.read()) + # dirs vfs.mkdir("foo_dir") diff --git a/tests/extmod/vfs_fat_fileio.py.exp b/tests/extmod/vfs_fat_fileio.py.exp index 4e34e83a82..a09442ae80 100644 --- a/tests/extmod/vfs_fat_fileio.py.exp +++ b/tests/extmod/vfs_fat_fileio.py.exp @@ -9,6 +9,7 @@ h e True d +hello!world! True True True