-
-
Notifications
You must be signed in to change notification settings - Fork 508
/
test_file_io.py
27 lines (22 loc) · 873 Bytes
/
test_file_io.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from os.path import join
from jedi.file_io import FolderIO
from test.helpers import get_example_dir
def test_folder_io_walk():
root_dir = get_example_dir('namespace_package')
iterator = FolderIO(root_dir).walk()
root, folder_ios, file_ios = next(iterator)
assert {f.path for f in folder_ios} == {join(root_dir, 'ns1'), join(root_dir, 'ns2')}
for f in list(folder_ios):
if f.path.endswith('ns1'):
folder_ios.remove(f)
root, folder_ios, file_ios = next(iterator)
assert folder_ios
assert root.path == join(root_dir, 'ns2')
folder_ios.clear()
assert next(iterator, None) is None
def test_folder_io_walk2():
root_dir = get_example_dir('namespace_package')
iterator = FolderIO(root_dir).walk()
root, folder_ios, file_ios = next(iterator)
folder_ios.clear()
assert next(iterator, None) is None