Skip to content

Commit

Permalink
pycodestyle try 2
Browse files Browse the repository at this point in the history
  • Loading branch information
srivarra committed Feb 24, 2022
1 parent 7a96be8 commit e932027
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions ark/utils/io_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ def test_list_folders():
get_test_and_other = iou.list_folders(temp_dir, substrs=['test_', 'other'],
exact_match=False)
assert sorted(get_test_and_other) == sorted(dirnames[1:])



# Tests "Exact Substring Matching", `exact_match` = True
with tempfile.TemporaryDirectory() as temp_dir:
# set up temp_dir subdirs
Expand All @@ -207,14 +206,14 @@ def test_list_folders():
'test_csv',
'test_out',
]

dirnames.sort()
for dirname in dirnames:
os.mkdir(os.path.join(temp_dir, dirname))

# add extra file
pathlib.Path(os.path.join(temp_dir, 'test_badfile.txt')).touch()

# test substrs is None (default)
get_all = iou.list_folders(temp_dir, exact_match=True)
print(get_all.sort())
Expand All @@ -228,21 +227,19 @@ def test_list_folders():
get_test_and_other = iou.list_folders(temp_dir, substrs=['test_', 'other'],
exact_match=True)
assert len(get_test_and_other) == 0

# test substrs is list (exact)
get_exact_n_substrs = iou.list_folders(temp_dir, substrs = ['tf_txt', 'othertf_txt'])
get_exact_n_substrs = iou.list_folders(temp_dir, substrs=['tf_txt', 'othertf_txt'])
assert sorted(get_exact_n_substrs) == ['othertf_txt', 'tf_txt']

# Test exact substr is not list (single string)
get_othertf_txt = iou.list_folders(temp_dir, substrs='othertf_txt', exact_match=True)
assert get_othertf_txt[0] == dirnames[0]

# Test exact substr DNE (single string)
get_test_c = iou.list_folders(temp_dir, substrs='test_c', exact_match=True)
assert len(get_test_c) == 0

# Test exact substr is not list (single string)
get_test_o = iou.list_folders(temp_dir, substrs='test_out', exact_match=True)
assert get_test_o[0] == dirnames[2]


0 comments on commit e932027

Please sign in to comment.