← Về thư mục
tests/relsa-severity-assessment/test_scripts.py
- r_reference · function · L92-L101 — def r_reference() -> "relsa_score.ReferenceModel"
- r_normalized_frame · function · L104-L110 — def r_normalized_frame() -> pd.DataFrame
- RParityTests · class · L113-L167 — class RParityTests(unittest.TestCase)
- setUp · method · L116-L118 — def setUp(self) -> None
- test_weights_match_the_published_matrix · method · L120-L132 — def test_weights_match_the_published_matrix(self) -> None
- test_relsa_scores_match_the_published_values · method · L134-L139 — def test_relsa_scores_match_the_published_values(self) -> None
- test_missing_variable_is_dropped_from_the_mean_not_zeroed · method · L141-L146 — def test_missing_variable_is_dropped_from_the_mean_not_zeroed(self) -> None: # Day 3 has burON missing: 5 variables enter the score, not 6.
- test_baseline_row_scores_zero_rather_than_missing · method · L148-L149 — def test_baseline_row_scores_zero_rather_than_missing(self) -> None
- test_root_mean_square_not_arithmetic_mean · method · L151-L156 — def test_root_mean_square_not_arithmetic_mean(self) -> None: # Day 0 weights: RMS = 0.73, arithmetic mean would be 0.645.
- test_full_precision_stays_close_to_the_rounded_score · method · L158-L167 — def test_full_precision_stays_close_to_the_rounded_score(self) -> None
- DirectionalityTests · class · L170-L231 — class DirectionalityTests(unittest.TestCase)
- _frame · method · L171-L174 — def _frame(self, rising: bool) -> pd.DataFrame: # One animal whose single variable either rises or falls from baseline.
- test_turned_variable_registers_an_increase · method · L176-L181 — def test_turned_variable_registers_an_increase(self) -> None
- test_rising_variable_left_unturned_scores_zero_throughout · method · L183-L201 — def test_rising_variable_left_unturned_scores_zero_throughout(self) -> None: # The silent failure this skill warns about: wrong directionality does not # error, it erases the variable's contribution. A second animal dips # slightly below baseline so the reference set is not degenerate.
- test_all_rising_variable_left_unturned_is_rejected_outright · method · L203-L208 — def test_all_rising_variable_left_unturned_is_rejected_outright(self) -> None: # When nothing in the reference set ever falls, the degenerate denominator # is caught rather than producing a scale of zeros.
- test_variable_that_only_ever_rises_and_is_not_turned_warns · method · L210-L223 — def test_variable_that_only_ever_rises_and_is_not_turned_warns(self) -> None: # The realistic mistake: a biomarker left out of --turned. Its baseline row # is absent, so every observed value is above 100 and the mismatch is # detectable rather than merely suspicious.
- test_recovery_below_baseline_is_floored_at_zero · method · L225-L231 — def test_recovery_below_baseline_is_floored_at_zero(self) -> None
- ReferenceModelTests · class · L234-L271 — class ReferenceModelTests(unittest.TestCase)
- test_reference_extrema_use_min_or_max_by_direction · method · L235-L248 — def test_reference_extrema_use_min_or_max_by_direction(self) -> None
- test_flat_variable_in_reference_set_is_rejected · method · L250-L254 — def test_flat_variable_in_reference_set_is_rejected(self) -> None
- test_reference_model_round_trips_through_json · method · L256-L265 — def test_reference_model_round_trips_through_json(self) -> None
- test_test_set_missing_a_reference_variable_errors · method · L267-L271 — def test_test_set_missing_a_reference_variable_errors(self) -> None
- DataPreparationTests · class · L274-L352 — class DataPreparationTests(unittest.TestCase)
- test_normalization_is_per_animal_and_lands_on_100 · method · L275-L285 — def test_normalization_is_per_animal_and_lands_on_100(self) -> None
- test_baseline_window_averages_several_time_points · method · L287-L292 — def test_baseline_window_averages_several_time_points(self) -> None
- test_zero_baseline_yields_nan_and_warns · method · L294-L301 — def test_zero_baseline_yields_nan_and_warns(self) -> None
- test_score_to_percent_maps_the_scale_not_the_ratio · method · L303-L305 — def test_score_to_percent_maps_the_scale_not_the_ratio(self) -> None
- test_score_to_percent_honours_a_nonzero_healthy_score · method · L307-L309 — def test_score_to_percent_honours_a_nonzero_healthy_score(self) -> None
- test_score_to_percent_handles_a_lower_is_worse_scale · method · L311-L314 — def test_score_to_percent_handles_a_lower_is_worse_scale(self) -> None: # A nesting score where a well-built nest is 5 and no nest is 0.
- test_score_to_percent_rejects_a_zero_width_scale · method · L316-L318 — def test_score_to_percent_rejects_a_zero_width_scale(self) -> None
- test_duplicate_id_time_rows_are_fatal · method · L320-L324 — def test_duplicate_id_time_rows_are_fatal(self) -> None
- test_changing_variable_composition_warns · method · L326-L344 — def test_changing_variable_composition_warns(self) -> None: # The published-sepsis trap: a variable measured only at the last time point.
- test_time_column_alias_is_detected · method · L346-L352 — def test_time_column_alias_is_detected(self) -> None
- MetricsTests · class · L355-L380 — class MetricsTests(unittest.TestCase)
- test_metrics_match_hand_computed_values · method · L356-L367 — def test_metrics_match_hand_computed_values(self) -> None
- test_picp_counts_values_outside_the_interval · method · L369-L374 — def test_picp_counts_values_outside_the_interval(self) -> None
- test_metrics_without_an_interval_report_nan_coverage · method · L376-L380 — def test_metrics_without_an_interval_report_nan_coverage(self) -> None
- ThresholdTests · class · L383-L439 — class ThresholdTests(unittest.TestCase)
- setUp · method · L384-L388 — def setUp(self) -> None
- test_bw_nrd0_matches_the_r_formula · method · L390-L395 — def test_bw_nrd0_matches_the_r_formula(self) -> None: # x = 1..10: sd = 3.02765, IQR = 4.5 -> 0.9 * min(sd, 4.5/1.349) * 10^-0.2
- test_bimodal_scores_yield_a_threshold_between_the_modes · method · L397-L405 — def test_bimodal_scores_yield_a_threshold_between_the_modes(self) -> None
- test_unimodal_scores_yield_no_threshold · method · L407-L417 — def test_unimodal_scores_yield_no_threshold(self) -> None: # Tail wiggle in the density estimate produces a minimum isolating a # single observation; the zone-mass filter must reject it.
- test_zone_assignment_and_names · method · L419-L428 — def test_zone_assignment_and_names(self) -> None
- test_thresholds_are_bandwidth_dependent · method · L430-L439 — def test_thresholds_are_bandwidth_dependent(self) -> None: # The skill's central caveat: a wider bandwidth can erase the minima.
- ForecastTests · class · L442-L533 — class ForecastTests(unittest.TestCase)
- setUp · method · L443-L448 — def setUp(self) -> None
- test_interpolation_hits_the_observed_points · method · L450-L456 — def test_interpolation_hits_the_observed_points(self) -> None
- test_forecast_of_a_linear_ramp_continues_the_ramp · method · L458-L464 — def test_forecast_of_a_linear_ramp_continues_the_ramp(self) -> None
- test_relsa_forecast_and_interval_are_non_negative · method · L466-L471 — def test_relsa_forecast_and_interval_are_non_negative(self) -> None
- test_target_before_the_last_observation_is_rejected · method · L473-L475 — def test_target_before_the_last_observation_is_rejected(self) -> None
- test_short_series_records_a_warning_note · method · L477-L481 — def test_short_series_records_a_warning_note(self) -> None
- test_interpolation_note_is_recorded_when_interpolating · method · L483-L492 — def test_interpolation_note_is_recorded_when_interpolating(self) -> None
- test_auto_arima_selects_differencing_for_a_trending_series · method · L494-L499 — def test_auto_arima_selects_differencing_for_a_trending_series(self) -> None
- test_predict_endpoint_scores_against_the_actual_value · method · L501-L512 — def test_predict_endpoint_scores_against_the_actual_value(self) -> None
- test_summarize_reports_per_animal_rows_and_an_overall_row · method · L514-L526 — def test_summarize_reports_per_animal_rows_and_an_overall_row(self) -> None
- test_rolling_forecast_produces_one_row_per_step · method · L528-L533 — def test_rolling_forecast_produces_one_row_per_step(self) -> None
- EndToEndCliTests · class · L537-L613 — class EndToEndCliTests(unittest.TestCase)
- setUp · method · L540-L542 — def setUp(self) -> None
- _run · method · L544-L551 — def _run(self, *args: str, cwd: Path) -> subprocess.CompletedProcess
- test_documented_pipeline_runs_end_to_end · method · L553-L600 — def test_documented_pipeline_runs_end_to_end(self) -> None
- test_score_scale_is_required_for_a_zero_baseline_score · method · L602-L613 — def test_score_scale_is_required_for_a_zero_baseline_score(self) -> None: # Without --score-scale the 0-baseline clinical score cannot be normalized, # and the run must say so rather than quietly producing a score.