← Về thư mục
tests/onekgpd/test_scripts.py
- emitted · function · L68-L81 — def emitted(handler, **arguments) -> dict
- failure_message · function · L84-L94 — def failure_message(handler, **arguments) -> str
- BundledDataTests · class · L102-L131 — class BundledDataTests(unittest.TestCase)
- test_the_bundled_cohort_is_the_published_one · method · L105-L109 — def test_the_bundled_cohort_is_the_published_one(self) -> None
- test_the_phase_three_subset_is_the_published_size · method · L111-L115 — def test_the_phase_three_subset_is_the_published_size(self) -> None: # 2,504 unrelated phase-3 samples plus 698 related individuals = 3,202.
- test_every_record_carries_the_keys_the_commands_read · method · L117-L125 — def test_every_record_carries_the_keys_the_commands_read(self) -> None
- test_the_limit_ceiling_is_the_cohort_size · method · L127-L131 — def test_the_limit_ceiling_is_the_cohort_size(self) -> None: # A limit above the cohort could never return more rows, so the cap and # the cohort must agree.
- AbsentValueTests · class · L134-L153 — class AbsentValueTests(unittest.TestCase)
- test_zero_and_empty_are_absent_but_an_identifier_is_present · method · L137-L141 — def test_zero_and_empty_are_absent_but_an_identifier_is_present(self) -> None
- test_null_if_absent_keeps_zero_out_of_the_output · method · L143-L147 — def test_null_if_absent_keeps_zero_out_of_the_output(self) -> None: # Emitting "0" as a paternal ID would invent a sample called 0.
- test_null_if_empty_keeps_zero_because_a_family_may_be_named_zero · method · L149-L153 — def test_null_if_empty_keeps_zero_because_a_family_may_be_named_zero(self) -> None: # The Java original distinguishes the two helpers; only the pid/mid # fields use "0" as a sentinel.
- ChildrenIndexTests · class · L156-L176 — class ChildrenIndexTests(unittest.TestCase)
- test_the_yoruba_trio_is_reconstructed_from_the_asset · method · L157-L161 — def test_the_yoruba_trio_is_reconstructed_from_the_asset(self) -> None: # Published pedigree: NA19240 is the daughter of NA19239 x NA19238.
- test_a_child_with_one_recorded_parent_is_not_indexed · method · L163-L172 — def test_a_child_with_one_recorded_parent_is_not_indexed(self) -> None: # Mirrors the SQL join: both parents must be present, otherwise the # "children" list would imply a trio that the cohort does not contain.
- test_founders_have_no_children_entry · method · L174-L176 — def test_founders_have_no_children_entry(self) -> None
- PopulationStatsAggregationTests · class · L179-L212 — class PopulationStatsAggregationTests(unittest.TestCase)
- record · method · L181-L189 — def record(**overrides) -> dict
- test_counts_are_aggregated_per_population_key · method · L191-L204 — def test_counts_are_aggregated_per_population_key(self) -> None
- test_an_unrecorded_sex_counts_toward_neither_column · method · L206-L209 — def test_an_unrecorded_sex_counts_toward_neither_column(self) -> None
- test_an_empty_subset_produces_no_groups · method · L211-L212 — def test_an_empty_subset_produces_no_groups(self) -> None
- SampleMetadataCommandTests · class · L215-L265 — class SampleMetadataCommandTests(unittest.TestCase)
- test_a_trio_child_reports_both_parents_and_its_relationship · method · L216-L224 — def test_a_trio_child_reports_both_parents_and_its_relationship(self) -> None
- test_a_founder_reports_no_parents_rather_than_zero · method · L226-L231 — def test_a_founder_reports_no_parents_rather_than_zero(self) -> None
- test_several_samples_come_back_sorted_and_deduplicated · method · L233-L239 — def test_several_samples_come_back_sorted_and_deduplicated(self) -> None
- test_whitespace_around_identifiers_is_tolerated · method · L241-L243 — def test_whitespace_around_identifiers_is_tolerated(self) -> None
- test_an_unknown_identifier_fails_and_names_it · method · L245-L251 — def test_an_unknown_identifier_fails_and_names_it(self) -> None
- test_sample_identifiers_are_case_sensitive · method · L253-L259 — def test_sample_identifiers_are_case_sensitive(self) -> None: # The variant commands take the same names; accepting a wrong case here # would produce IDs the query layer then rejects.
- test_an_empty_sample_list_fails · method · L261-L265 — def test_an_empty_sample_list_fails(self) -> None
- PopulationListingTests · class · L268-L294 — class PopulationListingTests(unittest.TestCase)
- test_all_populations_are_listed_and_add_up_to_the_cohort · method · L269-L274 — def test_all_populations_are_listed_and_add_up_to_the_cohort(self) -> None
- test_populations_are_ordered_by_superpopulation_then_code · method · L276-L282 — def test_populations_are_ordered_by_superpopulation_then_code(self) -> None
- test_the_five_superpopulations_partition_the_cohort · method · L284-L294 — def test_the_five_superpopulations_partition_the_cohort(self) -> None
- PopulationStatsCommandTests · class · L297-L357 — class PopulationStatsCommandTests(unittest.TestCase)
- test_the_sex_split_and_trio_count_are_internally_consistent · method · L298-L307 — def test_the_sex_split_and_trio_count_are_internally_consistent(self) -> None
- test_the_row_matches_an_independent_count_over_the_asset · method · L309-L313 — def test_the_row_matches_an_independent_count_over_the_asset(self) -> None
- test_a_code_and_its_full_name_select_the_same_population · method · L315-L321 — def test_a_code_and_its_full_name_select_the_same_population(self) -> None
- test_several_populations_are_returned_ordered_by_code · method · L323-L330 — def test_several_populations_are_returned_ordered_by_code(self) -> None
- test_an_unrecognised_population_fails_before_any_aggregation · method · L332-L336 — def test_an_unrecognised_population_fails_before_any_aggregation(self) -> None
- test_superpopulation_totals_equal_the_sum_of_their_populations · method · L338-L349 — def test_superpopulation_totals_equal_the_sum_of_their_populations(self) -> None
- test_an_unrecognised_superpopulation_fails · method · L351-L357 — def test_an_unrecognised_superpopulation_fails(self) -> None
- SelectSamplesByPopulationTests · class · L360-L465 — class SelectSamplesByPopulationTests(unittest.TestCase)
- defaults · method · L361-L369 — def defaults(self, **overrides) -> dict
- test_the_page_is_sorted_and_capped_by_limit · method · L371-L377 — def test_the_page_is_sorted_and_capped_by_limit(self) -> None
- test_skip_advances_the_window_without_dropping_rows · method · L379-L388 — def test_skip_advances_the_window_without_dropping_rows(self) -> None
- test_the_default_page_is_fifty_rows · method · L390-L397 — def test_the_default_page_is_fifty_rows(self) -> None
- test_a_skip_past_the_end_returns_an_empty_page_not_an_error · method · L399-L405 — def test_a_skip_past_the_end_returns_an_empty_page_not_an_error(self) -> None
- test_population_and_superpopulation_are_combined_with_and · method · L407-L420 — def test_population_and_superpopulation_are_combined_with_and(self) -> None: # YRI is African, so pairing it with EUR must match nobody -- an OR # would return the whole of Europe.
- test_a_superpopulation_alone_selects_across_its_populations · method · L422-L427 — def test_a_superpopulation_alone_selects_across_its_populations(self) -> None
- test_neither_selector_is_refused · method · L429-L434 — def test_neither_selector_is_refused(self) -> None
- test_the_limit_bounds_are_enforced_at_both_ends · method · L436-L451 — def test_the_limit_bounds_are_enforced_at_both_ends(self) -> None
- test_a_negative_skip_is_refused · method · L453-L458 — def test_a_negative_skip_is_refused(self) -> None
- test_an_unrecognised_population_is_refused · method · L460-L465 — def test_an_unrecognised_population_is_refused(self) -> None
- SharedHelperTests · class · L468-L490 — class SharedHelperTests(unittest.TestCase)
- test_csv_splitting_trims_and_drops_empty_tokens · method · L469-L473 — def test_csv_splitting_trims_and_drops_empty_tokens(self) -> None
- test_json_is_written_to_the_requested_path · method · L475-L480 — def test_json_is_written_to_the_requested_path(self) -> None
- test_without_a_path_a_temp_file_is_used_and_reported · method · L482-L490 — def test_without_a_path_a_temp_file_is_used_and_reported(self) -> None
- MetaParserTests · class · L493-L519 — class MetaParserTests(unittest.TestCase)
- test_a_subcommand_is_required · method · L494-L497 — def test_a_subcommand_is_required(self) -> None
- test_every_subcommand_binds_a_handler · method · L499-L511 — def test_every_subcommand_binds_a_handler(self) -> None
- test_repeated_population_flags_accumulate · method · L513-L519 — def test_repeated_population_flags_accumulate(self) -> None: # Full population names contain commas, so this flag repeats rather # than splitting on commas.
- region_args · function · L527-L546 — def region_args(**overrides) -> Namespace
- RecordingClient · class · L549-L574 — class RecordingClient
- init · method · L554-L558 — def init(self, target=None, **kwargs) -> None
- enter · method · L560-L561 — def enter(self)
- exit · method · L563-L564 — def exit(self, *exception) -> bool
- getattr · method · L566-L574 — def getattr(self, name)
- method · function · L570-L572 — def method(**kwargs)
- metadata · function · L577-L581 — def metadata(affected: bool = False)
- variant · function · L584-L596 — def variant(start: int = 43044295, **overrides)
- Stream · class · L599-L605 — class Stream
- init · method · L600-L602 — def init(self, variants, affected: bool = False) -> None
- to_list · method · L604-L605 — def to_list(self)
- Pages · class · L608-L614 — class Pages
- init · method · L609-L611 — def init(self, pages, affected: bool = False) -> None
- iter · method · L613-L614 — def iter(self)
- RegionParsingTests · class · L618-L672 — class RegionParsingTests(unittest.TestCase)
- test_a_region_string_becomes_a_typed_region · method · L619-L623 — def test_a_region_string_becomes_a_typed_region(self) -> None: # BRCA1 on GRCh38, 1-based inclusive.
- test_malformed_region_strings_name_the_expected_shape · method · L625-L629 — def test_malformed_region_strings_name_the_expected_shape(self) -> None
- test_coordinate_validation_is_left_to_the_library · method · L631-L634 — def test_coordinate_validation_is_left_to_the_library(self) -> None: # An inverted interval must not reach the service as a live query.
- test_a_single_region_carries_the_allele_narrowing · method · L636-L641 — def test_a_single_region_carries_the_allele_narrowing(self) -> None
- test_multiple_regions_are_parsed_in_order · method · L643-L651 — def test_multiple_regions_are_parsed_in_order(self) -> None
- test_mixing_the_two_region_modes_is_refused · method · L653-L657 — def test_mixing_the_two_region_modes_is_refused(self) -> None
- test_a_region_is_mandatory · method · L659-L661 — def test_a_region_is_mandatory(self) -> None
- test_an_incomplete_single_region_is_refused · method · L663-L667 — def test_an_incomplete_single_region_is_refused(self) -> None
- test_allele_narrowing_cannot_apply_to_many_regions · method · L669-L672 — def test_allele_narrowing_cannot_apply_to_many_regions(self) -> None: # One ref/alt pair cannot be meaningful across several intervals.
- ZygosityTests · class · L676-L692 — class ZygosityTests(unittest.TestCase)
- test_both_zygosities_are_included_by_default · method · L677-L679 — def test_both_zygosities_are_included_by_default(self) -> None: # Defaulting to one of them would silently halve every carrier count.
- test_each_flag_narrows_to_its_own_zygosity · method · L681-L687 — def test_each_flag_narrows_to_its_own_zygosity(self) -> None
- test_the_label_names_what_was_queried · method · L689-L692 — def test_the_label_names_what_was_queried(self) -> None
- AnnotationFilterTests · class · L696-L774 — class AnnotationFilterTests(unittest.TestCase)
- test_no_flags_means_no_filter_at_all · method · L697-L700 — def test_no_flags_means_no_filter_at_all(self) -> None: # An empty AnnotationFilter is not the same as None; sending one would # change the query semantics for an unfiltered run.
- test_csv_terms_become_a_tuple_of_library_enums · method · L702-L709 — def test_csv_terms_become_a_tuple_of_library_enums(self) -> None
- test_whitespace_in_a_csv_term_list_is_tolerated · method · L711-L717 — def test_whitespace_in_a_csv_term_list_is_tolerated(self) -> None
- test_an_unknown_vocabulary_term_is_rejected · method · L719-L723 — def test_an_unknown_vocabulary_term_is_rejected(self) -> None
- test_numeric_thresholds_pass_through_including_zero · method · L725-L731 — def test_numeric_thresholds_pass_through_including_zero(self) -> None: # af_lt=0 is falsy; a truthiness test would drop it.
- test_boolean_flags_are_only_set_when_asked · method · L733-L741 — def test_boolean_flags_are_only_set_when_asked(self) -> None
- test_an_alphamissense_class_and_score_together_are_refused · method · L743-L753 — def test_an_alphamissense_class_and_score_together_are_refused(self) -> None: # The class is derived from the score, so combining them is a # contradiction argparse cannot express as one group.
- test_either_alphamissense_selector_alone_is_accepted · method · L755-L766 — def test_either_alphamissense_selector_alone_is_accepted(self) -> None
- test_length_bounds_are_not_annotation_filter_fields · method · L768-L774 — def test_length_bounds_are_not_annotation_filter_fields(self) -> None: # They are client-method kwargs; putting them in the filter would raise.
- LabelAndEchoTests · class · L778-L846 — class LabelAndEchoTests(unittest.TestCase)
- test_chromosome_enums_render_as_their_conventional_names · method · L779-L786 — def test_chromosome_enums_render_as_their_conventional_names(self) -> None
- test_a_region_label_round_trips_the_parsed_string · method · L788-L792 — def test_a_region_label_round_trips_the_parsed_string(self) -> None
- test_many_regions_are_labelled_as_a_list · method · L794-L801 — def test_many_regions_are_labelled_as_a_list(self) -> None
- test_the_filter_echo_reports_only_what_was_set · method · L803-L814 — def test_the_filter_echo_reports_only_what_was_set(self) -> None
- test_an_unfiltered_request_echoes_no_filter_block · method · L816-L825 — def test_an_unfiltered_request_echoes_no_filter_block(self) -> None
- test_the_request_echo_records_alleles_and_samples · method · L827-L838 — def test_the_request_echo_records_alleles_and_samples(self) -> None
- test_a_variant_serialises_to_json_safe_keys · method · L840-L846 — def test_a_variant_serialises_to_json_safe_keys(self) -> None
- RetryTests · class · L850-L903 — class RetryTests(unittest.TestCase)
- test_a_successful_call_is_made_exactly_once · method · L851-L859 — def test_a_successful_call_is_made_exactly_once(self) -> None
- fetch · function · L854-L856 — def fetch()
- test_a_retryable_error_is_retried_up_to_the_bound_then_raised · method · L861-L876 — def test_a_retryable_error_is_retried_up_to_the_bound_then_raised(self) -> None
- fetch · function · L864-L866 — def fetch()
- test_a_non_retryable_error_is_raised_without_a_second_attempt · method · L878-L890 — def test_a_non_retryable_error_is_raised_without_a_second_attempt(self) -> None: # Retrying a rejected request just multiplies the load.
- fetch · function · L882-L884 — def fetch()
- test_a_call_that_recovers_returns_the_later_result · method · L892-L903 — def test_a_call_that_recovers_returns_the_later_result(self) -> None
- fetch · function · L895-L899 — def fetch()
- ApiCommandTestCase · class · L907-L925 — class ApiCommandTestCase(unittest.TestCase)
- setUp · method · L910-L915 — def setUp(self) -> None
- client · method · L918-L920 — def client(self) -> RecordingClient
- sent · method · L922-L925 — def sent(self, method: str) -> dict
- CountCommandTests · class · L928-L1008 — class CountCommandTests(ApiCommandTestCase)
- test_the_request_carries_the_region_zygosity_and_filter · method · L929-L959 — def test_the_request_carries_the_region_zygosity_and_filter(self) -> None
- test_the_public_1000_genomes_endpoint_is_the_one_contacted · method · L961-L970 — def test_the_public_1000_genomes_endpoint_is_the_one_contacted(self) -> None
- test_named_individuals_are_split_from_the_csv_flag · method · L972-L986 — def test_named_individuals_are_split_from_the_csv_flag(self) -> None
- test_an_incomplete_cluster_result_is_flagged_in_the_json · method · L988-L997 — def test_an_incomplete_cluster_result_is_flagged_in_the_json(self) -> None: # A partial answer that looks complete is the dangerous failure here.
- test_counting_individuals_never_passes_a_sample_list · method · L999-L1008 — def test_counting_individuals_never_passes_a_sample_list(self) -> None
- SelectVariantsCommandTests · class · L1011-L1074 — class SelectVariantsCommandTests(ApiCommandTestCase)
- base · method · L1012-L1022 — def base(self, **overrides) -> dict
- test_variants_are_returned_with_the_default_limit_applied · method · L1024-L1032 — def test_variants_are_returned_with_the_default_limit_applied(self) -> None
- test_hitting_the_limit_marks_the_result_as_truncated · method · L1034-L1040 — def test_hitting_the_limit_marks_the_result_as_truncated(self) -> None: # Silently returning a capped list would understate every carrier.
- test_a_result_below_the_limit_is_not_truncated · method · L1042-L1045 — def test_a_result_below_the_limit_is_not_truncated(self) -> None
- test_an_empty_result_is_reported_as_zero_not_as_an_error · method · L1047-L1052 — def test_an_empty_result_is_reported_as_zero_not_as_an_error(self) -> None
- test_paging_walks_every_page_and_cannot_truncate · method · L1054-L1066 — def test_paging_walks_every_page_and_cannot_truncate(self) -> None
- test_selecting_within_individuals_forwards_the_sample_list · method · L1068-L1074 — def test_selecting_within_individuals_forwards_the_sample_list(self) -> None
- SelectSamplesCommandTests · class · L1077-L1110 — class SelectSamplesCommandTests(ApiCommandTestCase)
- test_paging_arguments_reach_the_service_and_the_echo · method · L1078-L1094 — def test_paging_arguments_reach_the_service_and_the_echo(self) -> None
- test_unset_paging_is_omitted_from_the_echo · method · L1096-L1110 — def test_unset_paging_is_omitted_from_the_echo(self) -> None
- HomozygousReferenceTests · class · L1113-L1178 — class HomozygousReferenceTests(ApiCommandTestCase)
- arguments · method · L1114-L1120 — def arguments(self) -> dict
- test_a_real_count_is_reported_as_a_count · method · L1122-L1132 — def test_a_real_count_is_reported_as_a_count(self) -> None
- test_minus_one_means_no_variant_here_not_a_negative_count · method · L1134-L1150 — def test_minus_one_means_no_variant_here_not_a_negative_count(self) -> None: # The service uses -1 as a sentinel; reporting it as a count would be # nonsense, and reporting 0 would wrongly imply everyone carries it.
- test_zero_means_the_variant_exists_but_nobody_is_hom_ref · method · L1152-L1165 — def test_zero_means_the_variant_exists_but_nobody_is_hom_ref(self) -> None
- test_listing_hom_ref_individuals_echoes_the_position · method · L1167-L1178 — def test_listing_hom_ref_individuals_echoes_the_position(self) -> None
- KinshipCommandTests · class · L1181-L1219 — class KinshipCommandTests(ApiCommandTestCase)
- test_a_pair_is_reported_with_its_degree_and_coefficient · method · L1182-L1206 — def test_a_pair_is_reported_with_its_degree_and_coefficient(self) -> None: # NA19238 x NA19240 are mother and daughter: a first-degree pair with # an expected KING coefficient near 0.25.
- test_an_empty_pair_list_fails_rather_than_reporting_nothing · method · L1208-L1219 — def test_an_empty_pair_list_fails_rather_than_reporting_nothing(self) -> None
- DatasetInfoTests · class · L1222-L1255 — class DatasetInfoTests(ApiCommandTestCase)
- test_the_totals_and_cohorts_are_echoed_verbatim · method · L1223-L1255 — def test_the_totals_and_cohorts_are_echoed_verbatim(self) -> None
- ApiMainTests · class · L1259-L1307 — class ApiMainTests(unittest.TestCase)
- test_an_invalid_region_exits_one_with_a_message · method · L1260-L1268 — def test_an_invalid_region_exits_one_with_a_message(self) -> None: # ValueError from the input builders must never reach the user as a # traceback, and must never reach the service as a query.
- test_a_subcommand_is_required · method · L1270-L1273 — def test_a_subcommand_is_required(self) -> None
- test_the_documented_subcommands_all_parse · method · L1275-L1290 — def test_the_documented_subcommands_all_parse(self) -> None
- test_limit_and_page_size_are_mutually_exclusive · method · L1292-L1299 — def test_limit_and_page_size_are_mutually_exclusive(self) -> None: # Both together would mean "cap the walk" and "walk everything".
- test_the_zygosity_flags_are_mutually_exclusive · method · L1301-L1307 — def test_the_zygosity_flags_are_mutually_exclusive(self) -> None