Exemplo n.º 1
0
def test_equality():
    assert GeneAllele('J') == GeneAllele('J')
Exemplo n.º 2
0
def test_genotype_identity():
    a = GeneAllele('h')
    b = GeneAllele('H')

    assert Genotype(a, b) == Genotype(a, b)
Exemplo n.º 3
0
def test_different_value_case_are_not_same():
    assert GeneAllele('F') != GeneAllele('f')
Exemplo n.º 4
0
def test_incorrect_non_gene_allele_arguments():
    a = GeneAllele('k')
    b = 42
    with pytest.raises(ValueError):
        Genotype(a, b)
Exemplo n.º 5
0
def test_to_str():
    a = GeneAllele('C')
    b = GeneAllele('c')
    g = Genotype(a, b)
    assert str(g) == 'Cc'
Exemplo n.º 6
0
def test_incorrect_genotype_identity():
    a = GeneAllele('l')
    b = GeneAllele('L')

    assert Genotype(a, b) != Genotype(b, a)
Exemplo n.º 7
0
def test_incorrect_different_gene_allele_types():
    a = GeneAllele('z')
    b = GeneAllele('c')

    with pytest.raises(ValueError):
        Genotype(a, b)
Exemplo n.º 8
0
def test_sample_genotype_1():
    verbose_genotype = Genotype(GeneAllele('C'), GeneAllele('c'))
    convenient_genotype = create_genotype('Cc')
    assert convenient_genotype == verbose_genotype
Exemplo n.º 9
0
def create_genotype(genotype_str: str):
    if type(genotype_str) != str:
        raise ValueError('genotype_str must be a string!')
    if len(genotype_str) != 2:
        raise ValueError('genotype_str must have length of 2 characters!')
    return Genotype(GeneAllele(genotype_str[0]), GeneAllele(genotype_str[1]))
def test_gender_breeding_with_XX_XY_chromosome():
    f = XXGenotype(GeneAllele("A"),GeneAllele("a"))
    m = XYGenotype(GeneAllele("A"))
    results = [str(g) for g in gender_breed(f, m)]
    assert results == ["X^AX^A","X^AY","X^aX^A","X^aY"]
Exemplo n.º 11
0
def test_sample_breeding_a():
    a = Genotype(GeneAllele('Z'), GeneAllele('z'))
    b = Genotype(GeneAllele('Z'), GeneAllele('z'))

    breeding_results = [str(genotype) for genotype in breed(a, b)]
    assert breeding_results == ['ZZ', 'Zz', 'zZ', 'zz']
Exemplo n.º 12
0
#!/usr/bin/env python3

from gene_convenience import create_genotype as G
from gene import XYGenotype, XXGenotype, GeneAllele
from table_gen import create_table, create_gender_table

# create_table(G('Aa'), G('Aa'))
create_gender_table(XXGenotype(GeneAllele('A'), GeneAllele('a')),
                    XYGenotype(GeneAllele('a')))
Exemplo n.º 13
0
def test_xy_genotype():
    m = XYGenotype(GeneAllele('H'))
    assert m.gene_allele.value == 'H'
Exemplo n.º 14
0
def test_xx_genotype_mismatched_gene_alleles():
    with pytest.raises(ValueError):
        XXGenotype(GeneAllele('k'), GeneAllele('l'))
Exemplo n.º 15
0
def test_xx_genotype_wrong_arg_type():
    with pytest.raises(ValueError):
        XXGenotype(GeneAllele('c'), 39)
Exemplo n.º 16
0
def test_xx_genotype():
    f = XXGenotype(GeneAllele('L'), GeneAllele('l'))
    assert f.gene_allele_a.value == 'L' and f.gene_allele_b.value == 'l'