test_backtranslate.py 1.08 KB
Newer Older
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
1
2
"""Tests for the backtranslate module."""
from mutalyzer_backtranslate.backtranslate import BackTranslate, cmp_subst
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
3
4
5


class TestParser(object):
6
    """Test the backtranslate.backtranslate module."""
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
7
    def setup(self):
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
8
        self.bt = BackTranslate()
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
9
10

    def test_with_dna_1(self):
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
11
12
        assert cmp_subst(
            self.bt.with_dna('TGG', '*'),
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
13
14
15
            {1: set([('G', 'A')]), 2: set([('G', 'A')])})

    def test_with_dna_2(self):
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
16
17
        assert cmp_subst(
            self.bt.with_dna('GTA', 'L'),
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
18
19
20
            {0: set([('G', 'C'), ('G', 'T')])})

    def test_without_dna_1(self):
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
21
22
        assert cmp_subst(
            self.bt.without_dna('R', '*'),
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
23
24
25
            {0: set([('C', 'T'), ('A', 'T')])})

    def test_without_dna_2(self):
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
26
27
        assert cmp_subst(
            self.bt.without_dna('N', 'K'),
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
28
29
30
            {2: set([('T', 'G'), ('C', 'A'), ('C', 'G'), ('T', 'A')])})

    def test_without_dna_3(self):
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
31
32
        assert cmp_subst(
            self.bt.without_dna('R', 'S'), {
Jeroen F.J. Laros's avatar
Jeroen F.J. Laros committed
33
34
                0: set([('C', 'A')]),
                2: set([('G', 'C'), ('A', 'T'), ('A', 'C'), ('G', 'T')])})