Esempio n. 1
0
def test_hashible_of_dna_class():
    try:
        print(set(MyDNA("atgc")))
        print({MyDNA("atgc"): "smt"})

    except TypeError:
        raise pytest.fail("in hash dna test")
Esempio n. 2
0
def test_iterable_of_dna_class(value, expected_result):
    dna = MyDNA(value)
    actual_result = [nucl for nucl in dna]

    assert expected_result == actual_result
Esempio n. 3
0
def test_incorrect_transcribe_method_of_dna_class_with_wrong_param(value):
    with pytest.raises(TypeError, match="coding should be True or False"):
        MyDNA("atgc").transcribe(value)
Esempio n. 4
0
def test_correct_template_transcribe_method_of_dna_class(
        value, expected_result):
    dna = MyDNA(value)
    actual_result = dna.transcribe(False)
    assert actual_result == expected_result
Esempio n. 5
0
def test_reverse_complement_method_of_dna_class(value, expected_result):
    dna = MyDNA(value)
    actual_result = dna.reverse_complement()
    assert actual_result == expected_result
Esempio n. 6
0
def test_incorrect_gc_content_method_of_dna_class_with_empty_str():
    with pytest.raises(ValueError, match="at least one element"):
        MyDNA("").gc_content()
Esempio n. 7
0
def test_correct_gc_content_method_of_dna_class(value, expected_result):
    dna = MyDNA(value)
    actual_result = dna.gc_content()
    assert actual_result == expected_result
Esempio n. 8
0
def test_incorrect_construction_method_of_dna_class_with_not_dna_seq(value):
    with pytest.raises(TypeError, match="(contains A, T, C, G or N)"):
        MyDNA(value)
Esempio n. 9
0
def test_incorrect_construction_method_of_dna_class_with_not_string(value):
    with pytest.raises(TypeError, match="should be a string"):
        MyDNA(value)
Esempio n. 10
0
def test_hashible_of_dna_class_value():
    test_value = "test_value"
    test_key = MyDNA("atgc")
    test_dict = {test_key: "test_value"}

    assert test_value == test_dict[test_key]
Esempio n. 11
0
def test_not_equal_class_vs_str():
    assert MyDNA("ATGC") != "ATGC"
Esempio n. 12
0
def test_not_equal_of_dna_class():
    assert MyDNA("atgc") != MyDNA("a")
Esempio n. 13
0
def test_correct_construction_method_of_dna_class(value, expected_result):
    dna = MyDNA(value)
    actual_result = dna.dna
    assert actual_result == expected_result
Esempio n. 14
0
def test_equal_of_dna_class():
    assert MyDNA("atgc") == MyDNA("atgc")
Esempio n. 15
0
def test_dna_into_rna_class():
    dna = MyDNA("ATGC")
    rna = MyRNA(dna.transcribe())

    assert rna == MyRNA("AUGC")