Ejemplo n.º 1
0
def test_hashible_of_rna_class():
    try:
        print(set(MyRNA("augc")))
        print({MyRNA("augc"): "smt"})

    except TypeError:
        raise pytest.fail("in hash rna test")
Ejemplo n.º 2
0
def test_not_equal_class_rna_vs_str():
    assert MyRNA("AUGC") != "AUGC"
Ejemplo n.º 3
0
def test_equal_of_rna_class():
    assert MyRNA("augc") == MyRNA("augc")
Ejemplo n.º 4
0
def test_not_equal_of_rna_class():
    assert MyRNA("augc") != MyRNA("a")
Ejemplo n.º 5
0
def test_reverse_complement_method_of_rna_class(value, expected_result):
    rna = MyRNA(value)
    actual_result = rna.reverse_complement()
    assert actual_result == expected_result
Ejemplo n.º 6
0
def test_iterable_of_rna_class(value, expected_result):
    rna = MyRNA(value)
    actual_result = [nucl for nucl in rna]

    assert expected_result == actual_result
Ejemplo n.º 7
0
def test_correct_gc_content_method_of_rna_class(value, expected_result):
    rna = MyRNA(value)
    actual_result = rna.gc_content()
    assert actual_result == expected_result
Ejemplo n.º 8
0
def test_incorrect_gc_content_method_of_rna_class_with_empty_str():
    with pytest.raises(ValueError, match="at least one element"):
        MyRNA("").gc_content()
Ejemplo n.º 9
0
def test_incorrect_construction_method_of_rna_class_with_not_rna_seq(value):
    with pytest.raises(TypeError, match="(contains A, U, C, G or N)"):
        MyRNA(value)
Ejemplo n.º 10
0
def test_incorrect_construction_method_of_rna_class_with_not_string(value):
    with pytest.raises(TypeError, match="should be a string"):
        MyRNA(value)
Ejemplo n.º 11
0
def test_dna_into_rna_class():
    dna = MyDNA("ATGC")
    rna = MyRNA(dna.transcribe())

    assert rna == MyRNA("AUGC")
Ejemplo n.º 12
0
def test_correct_construction_method_of_rna_class(value, expected_result):
    rna = MyRNA(value)
    actual_result = rna.rna
    assert actual_result == expected_result
Ejemplo n.º 13
0
def test_hashible_of_rna_class_value():
    test_value = "test_value"
    test_key = MyRNA("augc")
    test_dict = {test_key: "test_value"}

    assert test_value == test_dict[test_key]