File: test_string_representation.py

package info (click to toggle)
pyensembl 2.3.13-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 612 kB
  • sloc: python: 4,199; makefile: 208; sh: 74
file content (80 lines) | stat: -rw-r--r-- 1,975 bytes parent folder | download | duplicates (2)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
from pyensembl import Locus, Gene, ensembl_grch37, Transcript, Exon
from .common import eq_


def test_Locus_string_representation():
    locus = Locus("X", 1000, 1010, "+")
    string_repr = str(locus)
    expected = "Locus(contig='X', start=1000, end=1010, strand='+')"
    eq_(string_repr, expected)


def test_Gene_string_representation():
    gene = Gene(
        gene_id="ENSG0001",
        gene_name="CAPITALISM",
        biotype="protein_coding",
        contig="Y",
        start=1,
        end=5,
        strand="+",
        genome=ensembl_grch37,
    )
    string_repr = str(gene)
    expected = (
        "Gene(gene_id='ENSG0001',"
        " gene_name='CAPITALISM',"
        " biotype='protein_coding',"
        " contig='Y',"
        " start=1, end=5, strand='+', genome='GRCh37')"
    )
    eq_(string_repr, expected)


def test_Transcript_string_representation():
    transcript = Transcript(
        transcript_id="ENST0001",
        transcript_name="CAPITALISM-001",
        gene_id="ENSG0001",
        biotype="protein_coding",
        contig="Y",
        start=1,
        end=5,
        strand="+",
        genome=ensembl_grch37,
    )

    expected = (
        "Transcript(transcript_id='ENST0001',"
        " transcript_name='CAPITALISM-001',"
        " gene_id='ENSG0001',"
        " biotype='protein_coding',"
        " contig='Y',"
        " start=1,"
        " end=5, strand='+', genome='GRCh37')"
    )
    string_repr = str(transcript)
    eq_(string_repr, expected)


def test_Exon_string_representation():
    exon = Exon(
        exon_id="ENSE0001",
        gene_id="ENSG0001",
        gene_name="CAPITALISM",
        contig="Y",
        start=1,
        end=5,
        strand="+",
    )

    expected = (
        "Exon(exon_id='ENSE0001',"
        " gene_id='ENSG0001',"
        " gene_name='CAPITALISM',"
        " contig='Y',"
        " start=1,"
        " end=5, strand='+')"
    )
    string_repr = str(exon)
    eq_(string_repr, expected)