Skip to content

test: bound invalid margin schedule iterator guard#35

Merged
stefan-jansen merged 1 commit into
mainfrom
test/finite-margin-schedule-iterator
Jul 11, 2026
Merged

test: bound invalid margin schedule iterator guard#35
stefan-jansen merged 1 commit into
mainfrom
test/finite-margin-schedule-iterator

Conversation

@stefan-jansen

Copy link
Copy Markdown
Contributor

Summary

  • make the invalid margin schedule iterator regression fixture finite
  • preserve the zero-read assertion so future eager materialization fails without hanging tests

Verification

  • uv run pytest tests/test_config_wiring.py::TestImmediateFill::test_invalid_margin_pct_schedule_export_keeps_non_sequences_scalar -q
  • pre-commit run --files tests/test_config_wiring.py

Copilot AI review requested due to automatic review settings July 11, 2026 18:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates a regression-test fixture in tests/test_config_wiring.py to ensure it can’t hang the test suite if code under test accidentally starts eagerly iterating an “invalid” margin schedule value. This supports the backtesting engine’s config serialization safety by keeping the “must not iterate non-sequence scalars” assertion while bounding worst-case iteration.

Changes:

  • Make the CountingIterator fixture finite by raising StopIteration after 5 reads.
  • Preserve the existing assertion that BacktestConfig.to_dict() must not consume the iterator (read_count == 0).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@stefan-jansen stefan-jansen merged commit 146ba6e into main Jul 11, 2026
8 checks passed
@stefan-jansen stefan-jansen deleted the test/finite-margin-schedule-iterator branch July 11, 2026 18:31
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.

2 participants