Skip to content

test: test_manipulation_index.py missing rollup-path coverage for 6 annotate flags #377

@dackclup

Description

@dackclup

Summary

tests/test_scoring/test_manipulation_index.py lacks test coverage for the full rollup path (weight × flag → index contribution) for 6 annotate flags that were added after the original test suite was written.

Missing test coverage

The following flags have weight constants in FLAG_WEIGHTS in compute/scoring/manipulation_index.py but no corresponding rollup-path test in test_manipulation_index.py:

  1. loss_avoidance_pattern_size_invariant — added in PR feat(defense): add loss_avoidance_pattern_size_invariant annotate (Phase 4b + Phase 3.x WARN polish) #180 (LOSS_AVOIDANCE_SIZE_INVARIANT_WEIGHT = 5)
  2. share_count_extraction_missing — added in PR feat(defense): add share_count_extraction_missing annotate (closes #176) #181 (weight in FLAG_WEIGHTS)
  3. insider_sell_cluster — added in PR feat(scoring): Phase 4.5e PR 3 — insider_sell_cluster + c_suite_unusual_sell annotates #222 (INSIDER_SELL_CLUSTER_WEIGHT = 5.0)
  4. c_suite_unusual_sell — added in PR feat(scoring): Phase 4.5e PR 3 — insider_sell_cluster + c_suite_unusual_sell annotates #222 (C_SUITE_UNUSUAL_SELL_WEIGHT = 3.0)
  5. restatement_high_confidence — added in PR feat(restatement): Epic #150 Phase 2.2 — add restatement_high_confidence annotate #165 (RESTATEMENT_HIGH_CONFIDENCE_WEIGHT = 3.0)
  6. extreme_estimate_majority — added in PR feat(defense): add extreme_estimate_majority annotate (issue #177) #183 (weight in FLAG_WEIGHTS)

What's needed

For each flag, add a test that:

  1. Constructs a StockMetrics object with that flag set to True (all others False)
  2. Calls compute_manipulation_index()
  3. Asserts the returned index equals the expected weight contribution (i.e., the FLAG_WEIGHTS[flag_name] value, scaled to 0–100)

This follows the existing pattern in test_manipulation_index.py for the older flags.

Why this matters

The rollup is additive and capped at 100. A mistake in FLAG_WEIGHTS (wrong sign, wrong scale, duplicate key) would silently produce a wrong index. Tests pin the weights against the literature-anchored provenance documented in PR #162.

Related

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions