Skip to content

test: the A-share floor sweep does not catch a restored flat constant #482

Description

@FlyM1ss

Follow-up from #474 item 1 (PR #477).

test_minimum_bars_never_exceeds_what_any_legal_window_can_actually_return (dashboard/backend/tests/infrastructure/market_data/test_ifind_ashare.py:511-539) sweeps all seven start weekdays and asserts floor <= weekdays * 4. Its docstring claims it "fails loudly if someone raises _MINIMUM_BAR_COMPLETENESS above 1.0 or restores a flat constant".

It does the first. It does not do the second:

  • floor = max(4, int(weekdays * 4 * completeness)), so the assertion reduces to completeness <= 1.0 — true for any value at or below 1.
  • A restored flat 40 passes every case in the sweep. A 14-day window holds at most 10 weekdays, 10 × 4 = 40, and 40 <= 40 holds. That is exactly the constant the change was made to remove, and it comes back green.

Fix shape: assert against a window the flat constant would break rather than against the widest one. A short legal window (say 3 weekdays → 12 reachable bars) separates a proportional floor from any flat value above 12. Mutation-check the new test by restoring return 40.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions