コード例 #1
0
def test_mutation_get_center_input_files():
    """
    Test to make sure center input files are gotten
    including the vcf files since process vcf is specified
    """
    syn_get_effects = [
        sample_clinical_entity, patient_clinical_entity, vcf1_entity,
        vcf2_entity
    ]
    expected_center_file_list = [[vcf1_entity], [vcf2_entity],
                                 [
                                     sample_clinical_entity,
                                     patient_clinical_entity
                                 ]]
    calls = [
        mock.call(sample_clinical_synid, downloadFile=True),
        mock.call(patient_clinical_synid, downloadFile=True),
        mock.call(vcf1synid, downloadFile=True),
        mock.call(vcf2synid, downloadFile=True)
    ]

    with patch.object(synapseutils, "walk",
                      return_value=walk_return()) as patch_synapseutils_walk,\
         patch.object(syn, "get",
                      side_effect=syn_get_effects) as patch_syn_get:
        center_file_list = input_to_database.get_center_input_files(
            syn, "syn12345", center, process="mutation")
        assert len(center_file_list) == len(expected_center_file_list)
        assert len(center_file_list[2]) == 2
        assert center_file_list == expected_center_file_list
        patch_synapseutils_walk.assert_called_once_with(syn, 'syn12345')
        patch_syn_get.assert_has_calls(calls)
コード例 #2
0
def test_main_get_center_input_files():
    '''Test to make sure center input files are retrieved.
    '''

    syn_get_effects = [
        sample_clinical_entity, patient_clinical_entity, vcf1_entity,
        vcf2_entity
    ]
    expected_center_file_list = [[vcf1_entity], [vcf2_entity],
                                 [
                                     sample_clinical_entity,
                                     patient_clinical_entity
                                 ]]
    calls = [
        mock.call(sample_clinical_synid),
        mock.call(patient_clinical_synid),
        mock.call(vcf1synid),
        mock.call(vcf2synid)
    ]

    with patch.object(synapseutils, "walk",
                      return_value=walk_return()) as patch_synapseutils_walk,\
         patch.object(syn, "get",
                      side_effect=syn_get_effects) as patch_syn_get:
        center_file_list = input_to_database.get_center_input_files(
            syn, "syn12345", center, process="vcf")
        assert len(center_file_list) == len(expected_center_file_list)
        assert len(center_file_list[2]) == 2
        assert center_file_list == expected_center_file_list
        patch_synapseutils_walk.assert_called_once_with(syn, 'syn12345')
        patch_syn_get.assert_has_calls(calls)
コード例 #3
0
def test_empty_get_center_input_files():
    '''
    Test that center input files is empty if directory
    pass in is empty
    '''
    with patch.object(
            synapseutils, "walk",
            return_value=walk_return_empty()) as patch_synapseutils_walk:
        center_file_list = input_to_database.get_center_input_files(
            syn, "syn12345", center, process="vcf")
        assert center_file_list == []
        patch_synapseutils_walk.assert_called_once_with(syn, 'syn12345')