Skip to content

Add tests for legacy momentum signal wrapper - #40

Merged
OnePunchMonk merged 1 commit into
mainfrom
test/momentum-legacy-coverage
Sep 23, 2026
Merged

OnePunchMonk merged 1 commit into
mainfrom
test/momentum-legacy-coverage

Conversation

@OnePunchMonk

Copy link
Copy Markdown
Owner

This PR adds test coverage for the backward-compatible wrapper create_momentum_signals in src/strategies/momentum.py. This function previously had 0% test coverage.

The new test file tests/test_momentum_legacy.py covers the following cases.

  • Passing a Series as input.
  • Passing a DataFrame as input.
  • Entries and exits are boolean and mutually exclusive.
  • Custom fast and slow window parameters produce different signals.
  • A flat price series produces no signals.

The README test count badge is bumped from 191 to 196 to match the new total.

Ran the full suite locally with pytest tests/ -q. All 196 tests pass.


Generated by Claude Code

src/strategies/momentum.py (the backward-compatible
create_momentum_signals wrapper) had 0% test coverage. Added tests
covering Series/DataFrame input, boolean/mutually-exclusive
entries-exits, custom window params, and a flat-price no-signal case.

Bumps test count badge from 191 to 196.

Copy link
Copy Markdown
Owner Author

CI is currently red on the Test Suite jobs (Python 3.10, 3.11, 3.12). All three fail at the same ruff check src/ tests/ step, with two findings.

  1. tests/test_momentum_legacy.py:5:8 F401, pytest imported but unused. This is in the file this PR adds, so it is this PR's issue.
  2. tests/test_tools.py:6:1 I001, import block un-sorted. This file is untouched by this PR (confirmed with git diff origin/main HEAD -- tests/test_tools.py, which is empty) and reproduces the same way against origin/main alone, so it is a pre-existing issue on main, not something this PR introduced.

I'm holding off on pushing a fix for the unused-import lint failure. My task instructions for this PR explicitly said not to push new commits or amend the existing one unless I stop and report back first, so I'm flagging this here rather than fixing it myself. The one-line fix is to drop the unused import pytest from tests/test_momentum_legacy.py.


Generated by Claude Code


Generated by Claude Code

@OnePunchMonk
OnePunchMonk merged commit 9b7d20f into main Sep 23, 2026
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant