Files
bin/finance/tests/test_projection.py
wlfb 020f41e9f2 feat: Szenario-Engine (Projektion, Modifikatoren, Zahlungsstrom)
Implementiert Task 5 mit TDD-Ansatz: projection.py mit Projection-Klasse
und project()-Funktion für Cashflow-Simulation; scenario.py mit PlainRecurring,
PlainPlanned, PlainModifier Dataclasses und build_cashflows() für Szenarien-Zahlungsströme
mit Modifier-Support (remove, percent, absolute). Alle 15 Tests grün.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 17:22:36 +02:00

21 lines
728 B
Python

from datetime import date
from decimal import Decimal
from app.engine.projection import project
def test_low_point_and_threshold():
flows = [(date(2026, 8, 1), Decimal("-150")), (date(2026, 8, 10), Decimal("200"))]
p = project(Decimal("100"), date(2026, 7, 31), flows, horizon_days=15,
threshold=Decimal("60"))
assert p.low_point == (date(2026, 8, 1), Decimal("-50"))
assert p.first_below_zero == date(2026, 8, 1)
assert p.first_below_threshold == date(2026, 8, 1)
assert p.series[-1][1] == Decimal("150")
def test_no_crossing():
p = project(Decimal("100"), date(2026, 7, 31), [], horizon_days=5)
assert p.first_below_zero is None
assert p.low_point[1] == Decimal("100")