57 lines
1.5 KiB
Python
57 lines
1.5 KiB
Python
from uuid import uuid4
|
|
|
|
import pytest
|
|
|
|
from cashflow_model import (
|
|
Account,
|
|
Asset,
|
|
FinancialModel,
|
|
Liability,
|
|
RecurringCashflow,
|
|
Transaction,
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_model() -> FinancialModel:
|
|
acc_id = uuid4()
|
|
return FinancialModel(
|
|
accounts=[
|
|
Account(id=acc_id, name="Основной счёт", currency="USD", balance=5000.0),
|
|
Account(name="Сбережения", currency="USD", balance=10000.0),
|
|
],
|
|
transactions=[
|
|
Transaction(
|
|
date="2026-01-01", account=str(acc_id),
|
|
category="income", amount=3000.0,
|
|
description="Зарплата",
|
|
),
|
|
Transaction(
|
|
date="2026-01-05", account=str(acc_id),
|
|
category="rent", amount=-1200.0,
|
|
description="Аренда",
|
|
),
|
|
],
|
|
recurring=[
|
|
RecurringCashflow(
|
|
start_date="2026-01-01", frequency="monthly",
|
|
amount=500.0, category="income",
|
|
),
|
|
RecurringCashflow(
|
|
start_date="2026-01-01", frequency="monthly",
|
|
amount=-200.0, category="subscription",
|
|
),
|
|
],
|
|
assets=[
|
|
Asset(name="Акции", value=50000.0, growth_rate=8.0),
|
|
],
|
|
liabilities=[
|
|
Liability(name="Кредит", balance=20000.0, interest=5.0, payment=500.0),
|
|
],
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def empty_model() -> FinancialModel:
|
|
return FinancialModel()
|