-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_adn.py
47 lines (32 loc) · 1.48 KB
/
test_adn.py
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
from adn import ADN
class TestADN:
def setUp(self):
# with open("adn.txt", "r", encoding='utf-8-sig') as f:
# string_sequence = f.read()
adn = ADN("sequence.txt")
return adn
def test_sequence_getter_returns_a_string(self):
adn = self.setUp()
assert type(adn.get_sequence()) == str
def test_conversion_table_getter_returns_a_dictionnary(self):
adn = self.setUp()
assert type(adn.get_conversion_table()) == dict
def test_get_codons_returns_a_list(self):
adn = self.setUp()
assert type(adn.split_sequence_in_array(3)) == list
def test_get_codons_returns_a_list_split_by_3_characters(self):
adn = self.setUp()
assert len(adn.split_sequence_in_array(3)[0]) == 3
assert len(adn.split_sequence_in_array(3)[2]) == 3
assert len(adn.split_sequence_in_array(3)[5]) == 3
def test_get_codons_returns_correct_characters(self):
adn = self.setUp()
assert adn.split_sequence_in_array(3)[0] == "CTC"
assert adn.split_sequence_in_array(3)[1] == "TTG"
assert adn.split_sequence_in_array(3)[2] == "AAC"
def test_convert_codon_to_proteine_returns_correct_key(self):
adn = self.setUp()
assert adn.convert_codon_to_proteine("GTT") == "V"
def test_convert_codon_sequence_to_proteines_returns_correct_list(self):
adn = self.setUp()
assert adn.convert_codon_sequence_to_proteines(["GTT", "CGT", "TGA"]) == "VR_"