fix: bugs-04
This commit is contained in:
@@ -8,7 +8,7 @@ import pytest
|
||||
from app.models.transaction import Direction
|
||||
from app.models.evidence_image import SourceApp
|
||||
from app.rules.dedup_rules import is_duplicate_pair
|
||||
from app.rules.transit_rules import is_self_transfer
|
||||
from app.rules.transit_rules import is_self_transfer, is_fee_tolerant_transit_pair
|
||||
from app.rules.assessment_rules import classify_transaction
|
||||
|
||||
|
||||
@@ -79,6 +79,32 @@ class TestTransitRules:
|
||||
tx = _make_tx(counterparty_name="李*华", remark="投资款")
|
||||
assert not is_self_transfer(tx, [])
|
||||
|
||||
def test_fee_tolerant_pair_match(self):
|
||||
out_tx = _make_tx(
|
||||
direction=Direction.out,
|
||||
amount=10000,
|
||||
trade_time=datetime(2026, 3, 8, 10, 0, tzinfo=timezone.utc),
|
||||
)
|
||||
in_tx = _make_tx(
|
||||
direction=Direction.in_,
|
||||
amount=9850, # 1.5% diff
|
||||
trade_time=datetime(2026, 3, 8, 10, 1, 30, tzinfo=timezone.utc),
|
||||
)
|
||||
assert is_fee_tolerant_transit_pair(out_tx, in_tx)
|
||||
|
||||
def test_fee_tolerant_pair_time_window_exceeded(self):
|
||||
out_tx = _make_tx(
|
||||
direction=Direction.out,
|
||||
amount=10000,
|
||||
trade_time=datetime(2026, 3, 8, 10, 0, tzinfo=timezone.utc),
|
||||
)
|
||||
in_tx = _make_tx(
|
||||
direction=Direction.in_,
|
||||
amount=9900,
|
||||
trade_time=datetime(2026, 3, 8, 10, 3, 1, tzinfo=timezone.utc),
|
||||
)
|
||||
assert not is_fee_tolerant_transit_pair(out_tx, in_tx)
|
||||
|
||||
|
||||
class TestAssessmentRules:
|
||||
def test_transit_classified_as_low(self):
|
||||
|
||||
Reference in New Issue
Block a user