def test_translate_coding_sequences_invalid_args(test_input, expectation): """Tests the behaviour of the translate_coding_sequences function with unexpected inputs""" with expectation: rfm.translate_coding_sequences(test_input)
def test_translate_coding_sequences_incorrect_sequences(seq_input, expected): """Tests the behaviour of the translate_coding_sequences function with different sequence inputs""" assert rfm.translate_coding_sequences(seq_input) == expected
def test_translate_coding_sequences_untranslatable_input(): assert rfm.translate_coding_sequences({1:"AAAAAAAAAAAA"}) == [{}, {}, {}, {1: 'AAAAAAAAAAAA'}]
"""Tests the behaviour of the translate_coding_sequences function with different sequence inputs""" assert rfm.determine_repeated(seq_input) == expected ############################################################################################ #### TEST remove_repeated ####################################################### coding_sequences_repeated = {1:"ATGGTCGAACGGTCGTCAAAGTCAGAGTACCCCGGGTACCAACTTACGGAGGATATTGCTTGCAGCTGCTAA", 2:"ATGGTCGAACGGTCGTCAAAGTCAGAGTACCCCGGGTACCAACTTACGGAGGATATTGCTTGCAGCTGCTAA", 3:"ATGTTCAAAGGCGAAAGAACAAAGGCTTACTGTGCGCAGAGGAACGCCCATTTTGCGGCTGGCGTCTATTGA"} coding_sequences_no_repeats = {1:"ATGGTCGAACGGTCGTCAAAGTCAGAGTACCCCGGGTACCAACTTACGGAGGATATTGCTTGCAGCTGCTAA", 2:"ATGTTCAAAGGCGAAAGAACAAAGGCTTACTGTGCGCAGAGGAACGCCCATTTTGCGGCTGGCGTCTATTGA"} proteins_repeated = rfm.translate_coding_sequences(coding_sequences_repeated)[0] proteins_repeated2 = rfm.translate_coding_sequences(coding_sequences_repeated)[0] proteins_no_repeat = rfm.translate_coding_sequences(coding_sequences_no_repeats)[0] repeated_list = rfm.determine_repeated(coding_sequences_repeated) @pytest.mark.parametrize( "proteins, repeated_ids, expectation", [(5,5, pytest.raises(TypeError)) ]) def test_remove_repeated_sequences_invalid_args(proteins, repeated_ids, expectation):
def test_translate_coding_sequences_ambiguous_input(): assert rfm.translate_coding_sequences({1:"ATGNGTCAATAA"}) == [{}, {}, {1: 'ATGNGTCAATAA'}, {}]
def test_translate_coding_sequences_valid_input(): assert rfm.translate_coding_sequences({1:"ATGGGTCAATAA"}) == [{1: 'MGQ'}, {1: 'sense'}, {}, {}]
def test_translate_coding_sequences_empty_str(): with pytest.raises(AttributeError): rfm.translate_coding_sequences("")
def test_translate_coding_sequences_int_input(): with pytest.raises(AttributeError): rfm.translate_coding_sequences(5)
def test_translate_coding_sequences_no_args(): with pytest.raises(TypeError): rfm.translate_coding_sequences()