diff options
author | Damien George <damien.p.george@gmail.com> | 2017-05-05 23:35:49 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-05-10 11:39:29 +1000 |
commit | 852c215d76de082adf57d3724907ab2c8d790e78 (patch) | |
tree | c02255c650d0ef8acd134e0f9d2e18e176e77c6f /tests/extmod/vfs_basic.py | |
parent | d4cd4831b01ff87b4a9f84bb88b165e3b156b3b4 (diff) |
tests/extmod/vfs: Update tests to reflect new ilistdir() method.
Diffstat (limited to 'tests/extmod/vfs_basic.py')
-rw-r--r-- | tests/extmod/vfs_basic.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/extmod/vfs_basic.py b/tests/extmod/vfs_basic.py index 32bfe8ab4..a3b2f3c29 100644 --- a/tests/extmod/vfs_basic.py +++ b/tests/extmod/vfs_basic.py @@ -20,9 +20,9 @@ class Filesystem: print(self.id, 'mount', readonly, mkfs) def umount(self): print(self.id, 'umount') - def listdir(self, dir): - print(self.id, 'listdir', dir) - return ['a%d' % self.id] + def ilistdir(self, dir): + print(self.id, 'ilistdir', dir) + return iter([('a%d' % self.id, 0, 0)]) def chdir(self, dir): print(self.id, 'chdir', dir) def getcwd(self): @@ -64,6 +64,18 @@ print(uos.getcwd()) uos.mount(Filesystem(1), '/test_mnt') print(uos.listdir()) +# ilistdir +i = uos.ilistdir() +print(next(i)) +try: + next(i) +except StopIteration: + print('StopIteration') +try: + next(i) +except StopIteration: + print('StopIteration') + # referencing the mount point in different ways print(uos.listdir('test_mnt')) print(uos.listdir('/test_mnt')) |