← Về thư mục
tests/bioservices/test_scripts.py
- quietly · function · L73-L76 — def quietly(function, args, *kwargs)
- DatabaseCodeTests · class · L79-L106 — class DatabaseCodeTests(unittest.TestCase)
- test_lowercase_aliases_resolve_to_the_official_code · method · L82-L85 — def test_lowercase_aliases_resolve_to_the_official_code(self) -> None
- test_aliases_are_matched_case_insensitively · method · L87-L89 — def test_aliases_are_matched_case_insensitively(self) -> None
- test_an_official_code_survives_normalisation · method · L91-L95 — def test_an_official_code_survives_normalisation(self) -> None: # Rewriting a valid code would break the mapping request.
- test_every_alias_maps_to_a_code_that_is_itself_stable · method · L97-L101 — def test_every_alias_maps_to_a_code_that_is_itself_stable(self) -> None: # Normalisation must be idempotent, or a second pass would corrupt it.
- test_an_unknown_code_is_passed_through_rather_than_rejected · method · L103-L106 — def test_an_unknown_code_is_passed_through_rather_than_rejected(self) -> None: # UniProt supports far more codes than the alias table lists.
- IdentifierFileTests · class · L109-L134 — class IdentifierFileTests(unittest.TestCase)
- setUp · method · L110-L113 — def setUp(self) -> None
- read · method · L115-L118 — def read(self, text: str)
- test_identifiers_are_read_one_per_line_and_trimmed · method · L120-L121 — def test_identifiers_are_read_one_per_line_and_trimmed(self) -> None
- test_comments_and_blank_lines_are_ignored · method · L123-L127 — def test_comments_and_blank_lines_are_ignored(self) -> None
- test_an_empty_file_yields_no_identifiers · method · L129-L130 — def test_an_empty_file_yields_no_identifiers(self) -> None
- test_a_missing_file_raises · method · L132-L134 — def test_a_missing_file_raises(self) -> None
- RecordingUniProt · class · L137-L148 — class RecordingUniProt
- init · method · L140-L142 — def init(self, verbose: bool = True) -> None
- mapping · method · L146-L148 — def mapping(self, fr: str, to: str, query: str)
- BatchConversionTests · class · L151-L258 — class BatchConversionTests(unittest.TestCase)
- setUp · method · L152-L163 — def setUp(self) -> None
- requests · method · L166-L168 — def requests(self) -> list[dict]
- convert · method · L170-L173 — def convert(self, ids, **kwargs)
- test_a_short_list_is_one_comma_separated_request · method · L175-L182 — def test_a_short_list_is_one_comma_separated_request(self) -> None
- test_a_long_list_is_split_into_chunks_of_the_requested_size · method · L184-L201 — def test_a_long_list_is_split_into_chunks_of_the_requested_size(self) -> None: # 250 identifiers at 100 per request is 3 requests: 100, 100, 50.
- test_a_chunk_size_larger_than_the_list_still_sends_one_request · method · L203-L205 — def test_a_chunk_size_larger_than_the_list_still_sends_one_request(self) -> None
- test_identifiers_that_never_map_are_reported_as_failed · method · L207-L214 — def test_identifiers_that_never_map_are_reported_as_failed(self) -> None
- test_an_empty_response_marks_the_whole_chunk_failed · method · L216-L220 — def test_an_empty_response_marks_the_whole_chunk_failed(self) -> None
- test_a_failed_chunk_is_retried_one_identifier_at_a_time · method · L222-L238 — def test_a_failed_chunk_is_retried_one_identifier_at_a_time(self) -> None: # UniProt rejects a whole batch when one identifier in it is malformed, # so the per-identifier retry is what rescues the rest.
- responder · function · L225-L230 — def responder(query: str)
- test_a_retry_that_also_fails_records_the_identifier_once · method · L240-L247 — def test_a_retry_that_also_fails_records_the_identifier_once(self) -> None
- responder · function · L241-L242 — def responder(query: str)
- test_the_delay_is_only_taken_between_chunks · method · L249-L254 — def test_the_delay_is_only_taken_between_chunks(self) -> None
- test_no_delay_is_taken_when_it_is_switched_off · method · L256-L258 — def test_no_delay_is_taken_when_it_is_switched_off(self) -> None
- MappingCsvTests · class · L261-L310 — class MappingCsvTests(unittest.TestCase)
- setUp · method · L262-L275 — def setUp(self) -> None
- test_the_header_is_the_documented_five_columns · method · L277-L281 — def test_the_header_is_the_documented_five_columns(self) -> None
- test_rows_are_sorted_by_source_identifier · method · L283-L286 — def test_rows_are_sorted_by_source_identifier(self) -> None
- test_multiple_targets_are_joined_with_semicolons · method · L288-L292 — def test_multiple_targets_are_joined_with_semicolons(self) -> None: # A comma would collide with the CSV delimiter.
- test_an_unmapped_identifier_is_written_as_an_empty_failed_row · method · L294-L297 — def test_an_unmapped_identifier_is_written_as_an_empty_failed_row(self) -> None
- test_the_source_and_target_databases_are_recorded_on_every_row · method · L299-L301 — def test_the_source_and_target_databases_are_recorded_on_every_row(self) -> None
- test_failed_identifiers_are_saved_only_when_there_are_some · method · L303-L310 — def test_failed_identifiers_are_saved_only_when_there_are_some(self) -> None
- FakeKegg · class · L313-L327 — class FakeKegg
- init · method · L316-L319 — def init(self, find_result: str = "", entries: dict | None = None) -> None
- find · method · L321-L323 — def find(self, database: str, query: str)
- get · method · L325-L327 — def get(self, identifier: str)
- KeggCompoundSearchTests · class · L330-L360 — class KeggCompoundSearchTests(unittest.TestCase)
- search · method · L331-L335 — def search(self, find_result: str)
- test_the_compound_database_is_searched_by_name · method · L337-L339 — def test_the_compound_database_is_searched_by_name(self) -> None
- test_the_cpd_prefix_is_stripped_from_the_first_hit · method · L341-L345 — def test_the_cpd_prefix_is_stripped_from_the_first_hit(self) -> None: # Downstream calls rebuild "cpd:", so keeping the prefix here would # produce "cpd:cpd:C00002".
- test_no_results_returns_no_identifier · method · L347-L351 — def test_no_results_returns_no_identifier(self) -> None
- test_a_service_error_returns_no_identifier_rather_than_raising · method · L353-L360 — def test_a_service_error_returns_no_identifier_rather_than_raising(self) -> None
- Broken · class · L354-L356 — class Broken
- find · method · L355-L356 — def find(self, *args)
- KeggEntryParsingTests · class · L363-L408 — class KeggEntryParsingTests(unittest.TestCase)
- setUp · method · L366-L368 — def setUp(self) -> None
- test_the_entry_is_requested_with_the_cpd_prefix · method · L370-L371 — def test_the_entry_is_requested_with_the_cpd_prefix(self) -> None
- test_the_published_formula_and_masses_are_extracted · method · L373-L376 — def test_the_published_formula_and_masses_are_extracted(self) -> None
- test_the_name_loses_its_trailing_semicolon · method · L378-L380 — def test_the_name_loses_its_trailing_semicolon(self) -> None: # KEGG separates synonyms with ";"; keeping it would corrupt the label.
- test_the_chebi_identifier_is_pulled_out_of_dblinks · method · L382-L384 — def test_the_chebi_identifier_is_pulled_out_of_dblinks(self) -> None: # ATP is CHEBI:15422.
- test_only_the_pathway_block_becomes_pathways · method · L386-L396 — def test_only_the_pathway_block_becomes_pathways(self) -> None: # Three PATHWAY lines. The indented DBLINKS lines that follow must not # be collected, or the pathway count is inflated by database links.
- test_an_entry_without_a_pathway_block_has_no_pathways · method · L398-L405 — def test_an_entry_without_a_pathway_block_has_no_pathways(self) -> None
- test_an_empty_response_is_reported_as_no_information · method · L407-L408 — def test_an_empty_response_is_reported_as_no_information(self) -> None
- ChebiAndChemblTests · class · L411-L488 — class ChebiAndChemblTests(unittest.TestCase)
- test_a_bare_chebi_number_is_prefixed_before_the_request · method · L412-L434 — def test_a_bare_chebi_number_is_prefixed_before_the_request(self) -> None: # The ChEBI service requires the "CHEBI:" namespace.
- FakeChebi · class · L416-L428 — class FakeChebi
- getCompleteEntity · method · L417-L428 — def getCompleteEntity(self, identifier)
- test_an_already_prefixed_identifier_is_not_prefixed_twice · method · L436-L446 — def test_an_already_prefixed_identifier_is_not_prefixed_twice(self) -> None
- FakeChebi · class · L439-L442 — class FakeChebi
- getCompleteEntity · method · L440-L442 — def getCompleteEntity(self, identifier)
- test_no_chebi_identifier_means_no_request_at_all · method · L448-L451 — def test_no_chebi_identifier_means_no_request_at_all(self) -> None
- test_the_chembl_lookup_uses_the_current_method_name · method · L453-L475 — def test_the_chembl_lookup_uses_the_current_method_name(self) -> None: #
get_compound_by_chemblId was removed after bioservices 1.6; the # current release exposes get_molecule, and the installed class must # actually have whatever the script calls.
- FakeChembl · class · L463-L470 — class FakeChembl
- get_molecule · method · L464-L470 — def get_molecule(self, identifier)
- test_no_chembl_identifier_means_no_request · method · L477-L480 — def test_no_chembl_identifier_means_no_request(self) -> None
- test_a_chembl_error_is_swallowed_into_a_none_result · method · L482-L488 — def test_a_chembl_error_is_swallowed_into_a_none_result(self) -> None
- Broken · class · L483-L485 — class Broken
- get_molecule · method · L484-L485 — def get_molecule(self, identifier)
- CompoundReportTests · class · L491-L526 — class CompoundReportTests(unittest.TestCase)
- test_the_report_records_every_identifier_that_was_resolved · method · L492-L516 — def test_the_report_records_every_identifier_that_was_resolved(self) -> None
- test_a_report_without_kegg_information_still_writes · method · L518-L526 — def test_a_report_without_kegg_information_still_writes(self) -> None: # The compound may resolve in ChEMBL but not in KEGG.
- FakeKgmlKegg · class · L529-L544 — class FakeKgmlKegg
- init · method · L532-L535 — def init(self, parsed: dict | None = None, entry: str = "") -> None
- parse_kgml_pathway · method · L537-L541 — def parse_kgml_pathway(self, pathway_id: str)
- get · method · L543-L544 — def get(self, pathway_id: str)
- PathwayAnalysisTests · class · L559-L665 — class PathwayAnalysisTests(unittest.TestCase)
- setUp · method · L560-L563 — def setUp(self) -> None
- analyse · method · L565-L566 — def analyse(self, kegg, pathway_id: str = "hsa04115")
- test_entries_and_relations_are_counted_and_typed · method · L568-L579 — def test_entries_and_relations_are_counted_and_typed(self) -> None
- test_a_pathway_without_kgml_is_skipped_not_fatal · method · L581-L583 — def test_a_pathway_without_kgml_is_skipped_not_fatal(self) -> None: # Many KEGG pathways have no KGML; one of them must not end the run.
- test_a_missing_name_falls_back_to_unknown · method · L585-L587 — def test_a_missing_name_falls_back_to_unknown(self) -> None
- test_an_empty_pathway_reports_zero_rather_than_failing · method · L589-L592 — def test_an_empty_pathway_reports_zero_rather_than_failing(self) -> None
- test_failed_pathways_are_dropped_from_the_batch · method · L594-L604 — def test_failed_pathways_are_dropped_from_the_batch(self) -> None
- Flaky · class · L595-L599 — class Flaky(FakeKgmlKegg)
- parse_kgml_pathway · method · L596-L599 — def parse_kgml_pathway(self, pathway_id)
- test_the_limit_truncates_the_pathway_list · method · L606-L612 — def test_the_limit_truncates_the_pathway_list(self) -> None
- test_the_summary_buckets_the_four_named_interaction_types · method · L614-L637 — def test_the_summary_buckets_the_four_named_interaction_types(self) -> None
- test_interactions_are_written_as_three_column_sif · method · L639-L648 — def test_interactions_are_written_as_three_column_sif(self) -> None
- test_per_pathway_files_are_named_without_a_colon · method · L650-L655 — def test_per_pathway_files_are_named_without_a_colon(self) -> None: # "path:hsa04115" would be an illegal filename on some systems.
- test_the_organism_is_set_on_the_client_before_listing_pathways · method · L657-L665 — def test_the_organism_is_set_on_the_client_before_listing_pathways(self) -> None
- FakeKeggOrganism · class · L658-L660 — class FakeKeggOrganism
- NcbiEmailTests · class · L668-L693 — class NcbiEmailTests(unittest.TestCase)
- test_a_valid_address_on_the_command_line_wins · method · L671-L675 — def test_a_valid_address_on_the_command_line_wins(self) -> None
- test_the_environment_is_the_fallback · method · L677-L679 — def test_the_environment_is_the_fallback(self) -> None
- test_surrounding_whitespace_is_stripped · method · L681-L682 — def test_surrounding_whitespace_is_stripped(self) -> None
- test_no_address_anywhere_yields_none · method · L684-L687 — def test_no_address_anywhere_yields_none(self) -> None
- test_malformed_addresses_are_refused · method · L689-L693 — def test_malformed_addresses_are_refused(self) -> None
- ProteinSearchTests · class · L696-L750 — class ProteinSearchTests(unittest.TestCase)
- FakeUniProt · class · L703-L717 — class FakeUniProt
- init · method · L704-L707 — def init(self, verbose: bool = True, retrieve=None, search="") -> None
- retrieve · method · L709-L713 — def retrieve(self, args, *kwargs)
- search · method · L715-L717 — def search(self, args, *kwargs)
- run_search · method · L719-L723 — def run_search(self, query: str, **kwargs)
- test_an_accession_shaped_query_is_retrieved_directly · method · L725-L730 — def test_an_accession_shaped_query_is_retrieved_directly(self) -> None: # P43403 is six characters starting with P, so it is fetched rather # than searched -- one request instead of a full-text query.
- test_a_name_query_falls_through_to_search · method · L732-L735 — def test_a_name_query_falls_through_to_search(self) -> None
- test_a_failed_direct_retrieval_falls_back_to_search · method · L737-L740 — def test_a_failed_direct_retrieval_falls_back_to_search(self) -> None
- test_a_header_only_response_finds_nothing · method · L742-L746 — def test_a_header_only_response_finds_nothing(self) -> None: # One line means the table had no data rows; indexing lines[1] would # raise instead of reporting "not found".
- test_an_empty_response_finds_nothing · method · L748-L750 — def test_an_empty_response_finds_nothing(self) -> None
- SequenceRetrievalTests · class · L753-L781 — class SequenceRetrievalTests(unittest.TestCase)
- FakeUniProt · class · L754-L761 — class FakeUniProt
- init · method · L755-L757 — def init(self, fasta) -> None
- retrieve · method · L759-L761 — def retrieve(self, identifier, frmt=None)
- test_the_fasta_header_is_dropped_and_the_lines_joined · method · L763-L769 — def test_the_fasta_header_is_dropped_and_the_lines_joined(self) -> None
- test_an_empty_response_yields_no_sequence · method · L771-L774 — def test_an_empty_response_yields_no_sequence(self) -> None
- test_a_service_error_yields_no_sequence · method · L776-L781 — def test_a_service_error_yields_no_sequence(self) -> None
- Broken · class · L777-L779 — class Broken
- retrieve · method · L778-L779 — def retrieve(self, args, *kwargs)
- BlastGuardTests · class · L784-L835 — class BlastGuardTests(unittest.TestCase)
- test_blast_is_not_submitted_without_a_contact_address · method · L785-L789 — def test_blast_is_not_submitted_without_a_contact_address(self) -> None: # EBI rejects anonymous submissions; sending one wastes a job slot.
- test_blast_is_not_submitted_when_explicitly_skipped · method · L791-L796 — def test_blast_is_not_submitted_when_explicitly_skipped(self) -> None
- test_a_finished_job_returns_its_result · method · L798-L820 — def test_a_finished_job_returns_its_result(self) -> None
- FakeBlast · class · L799-L811 — class FakeBlast
- init · method · L800-L801 — def init(self, verbose: bool = True) -> None
- run · method · L803-L805 — def run(self, **kwargs)
- getStatus · method · L807-L808 — def getStatus(self, jobid)
- getResult · method · L810-L811 — def getResult(self, jobid, kind)
- test_a_failed_job_returns_nothing_rather_than_polling_forever · method · L822-L835 — def test_a_failed_job_returns_nothing_rather_than_polling_forever(self) -> None
- FailingBlast · class · L823-L831 — class FailingBlast
- init · method · L824-L825 — def init(self, verbose: bool = True) -> None
- run · method · L827-L828 — def run(self, **kwargs)
- getStatus · method · L830-L831 — def getStatus(self, jobid)
- InteractionTests · class · L838-L888 — class InteractionTests(unittest.TestCase): #: A PSI-MI TAB record: the first 12 columns are what the parser reads.
- test_the_query_is_scoped_to_human_and_parsed_by_column · method · L851-L866 — def test_the_query_is_scoped_to_human_and_parsed_by_column(self) -> None
- FakePsicquic · class · L855-L858 — class FakePsicquic
- query · method · L856-L858 — def query(self, database, query)
- test_a_truncated_record_is_ignored_rather_than_indexed · method · L868-L874 — def test_a_truncated_record_is_ignored_rather_than_indexed(self) -> None
- FakePsicquic · class · L869-L871 — class FakePsicquic
- query · method · L870-L871 — def query(self, database, query)
- test_no_interactions_returns_an_empty_list · method · L876-L882 — def test_no_interactions_returns_an_empty_list(self) -> None
- FakePsicquic · class · L877-L879 — class FakePsicquic
- query · method · L878-L879 — def query(self, database, query)
- test_a_release_without_psicquic_skips_the_step · method · L884-L888 — def test_a_release_without_psicquic_skips_the_step(self) -> None: # bioservices 1.16.0 does not ship PSICQUIC; the workflow must degrade # rather than fail, and must not try to construct it.
- GoAnnotationTests · class · L891-L934 — class GoAnnotationTests(unittest.TestCase)
- annotations · method · L900-L910 — def annotations(self, payload: str)
- FakeQuickGo · class · L903-L906 — class FakeQuickGo
- Annotation · method · L904-L906 — def Annotation(self, **kwargs)
- test_terms_are_grouped_by_the_three_go_aspects · method · L912-L918 — def test_terms_are_grouped_by_the_three_go_aspects(self) -> None
- test_an_unknown_aspect_letter_is_discarded · method · L920-L926 — def test_an_unknown_aspect_letter_is_discarded(self) -> None
- test_no_annotations_yields_an_empty_list · method · L928-L930 — def test_no_annotations_yields_an_empty_list(self) -> None
- test_a_header_only_response_yields_empty_aspects · method · L932-L934 — def test_a_header_only_response_yields_empty_aspects(self) -> None