Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
funpack
Commits
553d1c5f
Commit
553d1c5f
authored
Dec 20, 2018
by
Paul McCarthy
🚵
Browse files
TEST: Make sure error is raised on bad input
parent
bba1a417
Changes
1
Hide whitespace changes
Inline
Side-by-side
ukbparse/tests/test_main.py
View file @
553d1c5f
...
...
@@ -1338,3 +1338,76 @@ def test_main_indexes():
expdf
.
columns
=
expcols
assert
np
.
all
(
df
[
expcols
]
==
expdf
[
expcols
])
@
patch_logging
def
test_main_bad_inputs
():
data
=
tw
.
dedent
(
"""
eid,col1
1,10
2,20
3,30
4,40
5,50
"""
)
badfile1
=
tw
.
dedent
(
"""
a
1
2
3
"""
)
badfile2
=
tw
.
dedent
(
"""
1
a
3
"""
)
with
tempdir
():
with
open
(
'data.txt'
,
'wt'
)
as
f
:
f
.
write
(
data
)
with
open
(
'badfile1.txt'
,
'wt'
)
as
f
:
f
.
write
(
badfile1
)
with
open
(
'badfile2.txt'
,
'wt'
)
as
f
:
f
.
write
(
badfile2
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'out.tsv nofile'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-v foo out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-v 1,foo,3 out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-v 1:foo:3 out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-v nofile out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-v badfile1.txt sout.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-v badfile2.txt sout.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-s foo out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-s 1,foo,3 out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-s 1:foo:3 out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-s nofile out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-s badfile1.txt sout.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-s badfile2.txt sout.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-ex foo out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-ex 1,foo,3 out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-ex 1:foo:3 out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-ex nofile out.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-ex badfile1.txt sout.tsv data.txt'
)
with
pytest
.
raises
(
Exception
):
main
.
main
(
'-ex badfile2.txt sout.tsv data.txt'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment