Skip to content

Commit 9e3172b

Browse files
committed
add tests for get_io and list_candidate_ios
1 parent 9204aa7 commit 9e3172b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

neo/test/iotest/test_get_io.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from pathlib import Path
2+
from tempfile import TemporaryDirectory
3+
from neo.io import get_io, list_candidate_ios, NixIO
4+
5+
6+
def test_list_candidate_ios_non_existant_file():
7+
# use plexon io suffix for testing here
8+
non_existant_file = 'non_existant_folder/non_existant_file.plx'
9+
ios = list_candidate_ios(non_existant_file)
10+
11+
assert ios
12+
13+
14+
def test_list_candidate_ios_filename_stub():
15+
# create dummy folder with dummy files
16+
with TemporaryDirectory(prefix='filename_stub_test_') as test_folder:
17+
test_folder = Path(test_folder)
18+
test_filename = (test_folder / 'dummy_file.nix')
19+
test_filename.touch()
20+
filename_stub = test_filename.with_suffix('')
21+
22+
# check that io is found even though file suffix was not provided
23+
ios = list_candidate_ios(filename_stub)
24+
25+
assert NixIO in ios
26+
27+
28+
def test_get_io_non_existant_file_writable_io():
29+
# use nixio for testing with writable io
30+
non_existant_file = 'non_existant_file.nix'
31+
io = get_io(non_existant_file)
32+
33+
assert isinstance(io, NixIO)

0 commit comments

Comments
 (0)