def test_hashible_of_rna_class(): try: print(set(MyRNA("augc"))) print({MyRNA("augc"): "smt"}) except TypeError: raise pytest.fail("in hash rna test")
def test_not_equal_class_rna_vs_str(): assert MyRNA("AUGC") != "AUGC"
def test_equal_of_rna_class(): assert MyRNA("augc") == MyRNA("augc")
def test_not_equal_of_rna_class(): assert MyRNA("augc") != MyRNA("a")
def test_reverse_complement_method_of_rna_class(value, expected_result): rna = MyRNA(value) actual_result = rna.reverse_complement() assert actual_result == expected_result
def test_iterable_of_rna_class(value, expected_result): rna = MyRNA(value) actual_result = [nucl for nucl in rna] assert expected_result == actual_result
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
def test_incorrect_gc_content_method_of_rna_class_with_empty_str(): with pytest.raises(ValueError, match="at least one element"): MyRNA("").gc_content()
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)
def test_incorrect_construction_method_of_rna_class_with_not_string(value): with pytest.raises(TypeError, match="should be a string"): MyRNA(value)
def test_dna_into_rna_class(): dna = MyDNA("ATGC") rna = MyRNA(dna.transcribe()) assert rna == MyRNA("AUGC")
def test_correct_construction_method_of_rna_class(value, expected_result): rna = MyRNA(value) actual_result = rna.rna assert actual_result == expected_result
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]