Example #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")
Example #2
0
def test_not_equal_class_rna_vs_str():
    assert MyRNA("AUGC") != "AUGC"
Example #3
0
def test_equal_of_rna_class():
    assert MyRNA("augc") == MyRNA("augc")
Example #4
0
def test_not_equal_of_rna_class():
    assert MyRNA("augc") != MyRNA("a")
Example #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
Example #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
Example #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
Example #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()
Example #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)
Example #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)
Example #11
0
def test_dna_into_rna_class():
    dna = MyDNA("ATGC")
    rna = MyRNA(dna.transcribe())

    assert rna == MyRNA("AUGC")
Example #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
Example #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]