Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Terminal fragment selector
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
zavolan_group
tools
Terminal fragment selector
Commits
6993b862
Commit
6993b862
authored
2 years ago
by
Hugo Madge Leon
Browse files
Options
Downloads
Patches
Plain Diff
Cleaned and finished tests
parent
bdd0ee5d
No related branches found
No related tags found
1 merge request
!46
Merged Tanya's files + final lint check
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
term_frag_sel/cli.py
+3
-0
3 additions, 0 deletions
term_frag_sel/cli.py
tests/test_cli.py
+18
-2
18 additions, 2 deletions
tests/test_cli.py
tests/test_files/test.csv
+49
-50
49 additions, 50 deletions
tests/test_files/test.csv
tests/test_files/test_tab.csv
+50
-0
50 additions, 0 deletions
tests/test_files/test_tab.csv
with
120 additions
and
52 deletions
term_frag_sel/cli.py
+
3
−
0
View file @
6993b862
...
...
@@ -18,6 +18,9 @@ def main(args: argparse.Namespace):
Args:
args (parser): list of arguments from CLI.
"""
if
not
isinstance
(
args
,
argparse
.
Namespace
):
raise
TypeError
(
"
Input should be argparse.Namespace
"
)
# Create or wipe output file
with
open
(
args
.
output
,
"
w
"
,
encoding
=
"
utf-8
"
)
as
_
:
pass
...
...
This diff is collapsed.
Click to expand it.
tests/test_cli.py
+
18
−
2
View file @
6993b862
...
...
@@ -3,13 +3,29 @@ import pytest
import
pandas
as
pd
# from Bio import SeqIO
from
term_frag_sel.cli
import
file_validation
# type: ignore
from
term_frag_sel.cli
import
file_validation
,
main
# type: ignore
FASTA_FILE
=
"
tests/test_files/test.fasta
"
CSV_FILE
=
"
tests/test_files/test.csv
"
TAB_FILE
=
"
tests/test_files/test_tab.csv
"
_
,
csv_counts
=
file_validation
(
FASTA_FILE
,
CSV_FILE
,
"
,
"
)
_
,
tab_counts
=
file_validation
(
FASTA_FILE
,
TAB_FILE
,
"
\t
"
)
def
test_file
():
"""
Test file_validation function.
"""
assert
isinstance
(
file_validation
(
FASTA_FILE
,
CSV_FILE
,
"
,
"
),
tuple
[
dict
,
pd
.
DataFrame
])
assert
isinstance
(
file_validation
(
FASTA_FILE
,
TAB_FILE
,
"
\t
"
),
tuple
[
dict
,
pd
.
DataFrame
])
assert
csv_counts
.
equals
(
tab_counts
)
with
pytest
.
raises
(
FileNotFoundError
):
file_validation
(
""
,
""
,
"
,
"
)
file_validation
(
FASTA_FILE
,
""
,
"
,
"
)
with
pytest
.
raises
(
FileNotFoundError
):
file_validation
(
""
,
CSV_FILE
,
"
,
"
)
with
pytest
.
raises
(
ValueError
):
file_validation
(
CSV_FILE
,
CSV_FILE
,
"
,
"
)
def
test_main
():
"""
Test main() function.
"""
with
pytest
.
raises
(
TypeError
):
main
(
""
)
This diff is collapsed.
Click to expand it.
tests/test_files/test.csv
+
49
−
50
View file @
6993b862
,seqID,count
0,1,120
0,1,86
1,2,60
2,3,
7
6
3,4,1
41
4,5,1
07
5,6,
5
9
6,7,1
21
7,8,
7
2
8,9,1
14
9,10,
126
10,11,
77
11,12,
130
12,13,1
46
13,14,
6
9
14,15,
62
15,16,
93
16,17,
103
17,18,
150
18,19,1
4
0
19,20,
56
20,21,
103
21,22,1
1
5
22,23,1
13
23,24,
53
24,25,
9
5
25,26,
112
26,27,
102
27,28,5
3
28,29,
139
29,30,14
3
30,31,1
50
31,32,
12
6
32,33,5
0
33,34,
94
34,35,
81
35,36,11
6
36,37,
51
37,38,
110
38,39,
98
39,40,
60
40,41,5
7
41,42,
73
42,43,
143
43,44,1
16
44,45,
98
45,46,1
39
46,47,8
9
47,48,
6
3
48,49,
68
49,50,8
4
2,3,
5
6
3,4,1
29
4,5,1
38
5,6,
8
9
6,7,1
07
7,8,
5
2
8,9,
8
1
9,10,
83
10,11,
139
11,12,
66
12,13,1
05
13,14,
5
9
14,15,
93
15,16,
134
16,17,
50
17,18,
64
18,19,1
1
0
19,20,
119
20,21,
54
21,22,1
0
5
22,23,1
24
23,24,
109
24,25,
12
5
25,26,
98
26,27,
88
27,28,5
5
28,29,
70
29,30,14
7
30,31,1
23
31,32,
6
6
32,33,5
4
33,34,
60
34,35,
79
35,36,1
2
1
36,37,
69
37,38,
63
38,39,
121
39,40,
149
40,41,5
2
41,42,
100
42,43,
54
43,44,
8
1
44,45,
150
45,46,1
16
46,47,
12
8
47,48,
7
3
48,49,
144
49,50,8
9
This diff is collapsed.
Click to expand it.
tests/test_files/test_tab.csv
0 → 100644
+
50
−
0
View file @
6993b862
0 1 86
1 2 102
2 3 81
3 4 91
4 5 121
5 6 82
6 7 103
7 8 125
8 9 135
9 10 133
10 11 110
11 12 108
12 13 89
13 14 125
14 15 76
15 16 85
16 17 130
17 18 63
18 19 137
19 20 55
20 21 148
21 22 101
22 23 145
23 24 99
24 25 50
25 26 101
26 27 134
27 28 60
28 29 107
29 30 134
30 31 76
31 32 118
32 33 99
33 34 64
34 35 97
35 36 118
36 37 131
37 38 142
38 39 119
39 40 50
40 41 90
41 42 65
42 43 140
43 44 145
44 45 84
45 46 144
46 47 103
47 48 96
48 49 50
49 50 112
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment