Skip to content

test(trading): cover transaction merge dedup and position parsing helpers - #3740

Draft
Herklos wants to merge 1 commit into
devfrom
cursor/nightly-tests-audit-7327
Draft

Herklos wants to merge 1 commit into
devfrom
cursor/nightly-tests-audit-7327

Conversation

@Herklos

@Herklos Herklos commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Thank you for sending your pull request.
But first, have you included unit tests, and is your code PEP8 conformant? More details

Summary

Add direct unit tests for two pure trading helpers that had no coverage: merge_transactions_deduped and the parse_position_* helpers. Test-only change, no production code touched.

Solve the issue: none

Changelog

  • Add unit tests for merge_transactions_deduped (ordering, dedup against existing and within new, input immutability)
  • Add unit tests for parse_position_status, parse_position_side, parse_position_margin_type, parse_position_mode (known values and missing key)

What's new?

Nightly tests audit (aspect: tests missing for critical paths). merge_transactions_deduped feeds the portfolio history and account state merges in packages/flow, so dedup regressions would double-count transactions. The parse_position_* helpers turn exchange position rows into enums during position creation and had no direct tests.

Scope is limited to two new test files under packages/trading/tests/personal_data/. No existing test or source file is modified.

Verification:

  • pytest packages/trading/tests/personal_data -n auto from packages/trading: 801 passed.
  • Mutation check: removing the continue on duplicate TXIDs makes 2 new tests fail.
  • python -m tools.extended_linter --base origin/dev: 0 violations.
Open in Web Open in Cursor 

…pers

Add unit tests for merge_transactions_deduped and the parse_position_*
helpers, which had no direct coverage. Test-only change.

Co-authored-by: herklos.dev <herklos.dev@protonmail.com>
@Herklos Herklos self-assigned this Oct 13, 2026

This branch has not been deployed

No deployments
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