Пример #1
0
def test_extract_coding_sequences_invalid_inputs(reading_frames, contigs, starting_id, genome_id, expectation):
        """Tests the behaviour of the extract_coding_sequences function with unexpected inputs"""
        with expectation:
                rfm.extract_coding_sequences(reading_frames, contigs, starting_id, genome_id)   
Пример #2
0
         ("/home/pcerqueira/Lab_Software/testing/tests/GCA-000007265-protein1.fasta", expected_output)                                          # Test with a valid input.
         ])
def test_import_contigs_invalid_file_inputs(file_input, expected):
        """Tests the behaviour of the import_contigs function with unexpected file inputs"""
        assert rfm.import_contigs(file_input) == expected

##############################################################


#### TEST extract_coding_sequences ########################################

orf_file_path = "GCA_000007265.1_ASM726v1_genomic.fna_ORF.txt"

contigs = rfm.import_contigs("GCA_000007265.1_ASM726v1_genomic.fna")

valid_output = rfm.extract_coding_sequences(orf_file_path, contigs, 0, 0)

@pytest.mark.parametrize(
        "reading_frames, contigs, starting_id, genome_id, expectation",
        [([],[],[],[], pytest.raises(TypeError)),                       # Test empty list input
         ("","","","", pytest.raises(FileNotFoundError)),               # Test empty string input
#         (7,7,7,5, pytest.raises(TypeError)),
         (orf_file_path, "", "", "", pytest.raises(TypeError)),         # Test with vaild file and empty string input
         (orf_file_path, contigs, "", "", pytest.raises(TypeError)),    # Test with valid file, contig dict and empty string input
         ])
def test_extract_coding_sequences_invalid_inputs(reading_frames, contigs, starting_id, genome_id, expectation):
        """Tests the behaviour of the extract_coding_sequences function with unexpected inputs"""
        with expectation:
                rfm.extract_coding_sequences(reading_frames, contigs, starting_id, genome_id)   
        
def test_extract_coding_sequences_valid_input():
Пример #3
0
def test_extract_coding_sequences_valid_input():
        """Tests the behaviour of the extract_coding_sequences function with a valid input"""
        assert rfm.extract_coding_sequences(orf_file_path, contigs, 0, 0) == valid_output
Пример #4
0
def test_extract_coding_sequences_no_int_input():
   with pytest.raises(TypeError):
       rfm.extract_coding_sequences(orf_file_path, contigs, "", "")
Пример #5
0
def test_extract_coding_sequences_valid_input():
    assert rfm.extract_coding_sequences(orf_file_path, contigs, 0, 0) == valid_output
Пример #6
0
def test_extract_coding_sequences_empty_str_input():
   with pytest.raises(FileNotFoundError):
       rfm.extract_coding_sequences("","","","")
Пример #7
0
def test_extract_coding_sequences_int_input():
   with pytest.raises(TypeError):
       rfm.extract_coding_sequences(7,7,7,5)
Пример #8
0
def test_extract_coding_sequences_invalid_orf_file():
   with pytest.raises(UnpicklingError):
       rfm.extract_coding_sequences("existing.txt", "","","")
Пример #9
0
def test_extract_coding_sequences_empty_list_input():
   with pytest.raises(TypeError):
       rfm.extract_coding_sequences([],[],[],[])
Пример #10
0
def test_extract_coding_sequences_no_args():
   with pytest.raises(TypeError):
       rfm.extract_coding_sequences()