-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_functions.py
More file actions
61 lines (49 loc) · 1.9 KB
/
test_functions.py
File metadata and controls
61 lines (49 loc) · 1.9 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from lib.str_manip import dashed
from thread_denovo_trna import simple_match, import_dash_pattern
from lib.Sequence import Sequence
import mypy
from typing import List, Dict, Tuple
def test_dashed():
"""
We're okay with a terminating space because we can just strip it off if it
ever matters.
"""
assert(dashed([1,2,3,7,8,9], 'A') == "A:1-3 A:7-9 ")
def test_dashed_solo():
"""
We're okay with a terminating space because we can just strip it off if it
ever matters.
"""
assert(dashed([1,2,3,7,8,9,15], 'A') == "A:1-3 A:7-9 A:15 ")
def test_dashed_solo_mid():
"""
We're okay with a terminating space because we can just strip it off if it
ever matters.
"""
assert(dashed([1,2,3,5,7,8,9], 'A') == "A:1-3 A:5 A:7-9 ")
def test_simple_match_identity():
"""
aaa
"""
assert(simple_match(Sequence('A-'), Sequence('A-')) == 10)
assert(simple_match(Sequence('G-'), Sequence('G-')) == 10)
assert(simple_match(Sequence('GGAA---'), Sequence('GGAA---')) == 35)
def test_simple_match_gap_penalty():
assert(simple_match(Sequence('A-'), Sequence('-A')) == -20)
def test_simple_match_purine_eq():
assert(simple_match(Sequence('A-'), Sequence('G-')) == 7)
def test_simple_match_pyrimidine_eq():
assert(simple_match(Sequence('U-'), Sequence('C-')) == 7)
def test_simple_match_mod_U_eq():
assert(simple_match(Sequence('U-'), Sequence('T-')) == 8)
def test_import_dash_pattern_middle():
assert(import_dash_pattern(Sequence('A--A', '....'), 'GG') == 'G--G')
def test_import_dash_pattern_beginning():
assert(import_dash_pattern(Sequence('---AA', '....'), 'GG') == '---GG')
def test_import_dash_pattern_end():
assert(import_dash_pattern(Sequence('AA---', '....'), 'GG') == 'GG---')
def test_import_dash_pattern_dashes():
"""
Does this make sense?
"""
assert(import_dash_pattern(Sequence('AA---', '....'), 'G-G') == 'G---G')