def test_FormatExtensionMap_no_ffkey(realistic_format_search_result): fe_map = FormatExtensionMap(ffe_all=realistic_format_search_result) assert hasattr(fe_map, 'fe_dict') assert fe_map.fe_dict == {'bam':{'standard_extension': 'bam', 'other_allowed_extensions': [], 'extrafile_formats': ['/file-formats/bai/']}, 'bai':{'standard_extension': 'bam.bai', 'extrafile_formats': [], 'other_allowed_extensions': []}} assert fe_map.get_extension('bam') == 'bam' assert fe_map.get_other_extensions('bai') == [] assert fe_map.get_extension('fastq') is None
def test_FormatExtensionMap2(realistic_format_search_result): with mock.patch("tibanna_ffcommon.file_format.search_metadata", return_value=realistic_format_search_result): fe_map = FormatExtensionMap({'server': 'some_server'}) assert hasattr(fe_map, 'fe_dict') assert fe_map.fe_dict == {'bam':{'standard_extension': 'bam', 'other_allowed_extensions': [], 'extrafile_formats': ['/file-formats/bai/']}, 'bai':{'standard_extension': 'bam.bai', 'extrafile_formats': [], 'other_allowed_extensions': []}} assert fe_map.get_extension('bam') == 'bam' assert fe_map.get_other_extensions('bai') == [] assert fe_map.get_extension('fastq') is None