oqyude
|
2f02a5de63
|
D11: тесты-характеристики — фиксация текущего поведения
+71 тест (81 → 160). Характеристики фиксируют существующее поведение как есть;
их правка — вместе с изменением поведения (Tier 2, D14–D16).
- tests/test_forecast.py: TestForecastCharacterization — точные 24 строки
forecast_cashflow(12), summary(6)/summary(12), неидемпотентность повторного
прогноза (Tier 2, D14), расхождение summary после прогноза, влияние горизонта
- tests/test_scenarios.py: TestScenarioCharacterization — числа baseline/
optimistic/pessimistic на 6 и 12 мес., what_if, совпадение compare() с apply()
- tests/test_ai.py: TestAssistantCompareScenarios — точный текст промпта
compare_scenarios (251 символ), display_currency, подстановка JSON
- tests/test_model.py: TestPydanticValidators — все 7 валидаторов домена
(balance, amount×2, frequency, interest/payment, множители×3, rate) с
проверкой текста ошибки; TestDecimalCoercionAndIds
- tests/test_currency.py: TestRoundingBoundaries — 18 границ .5 для
format_money (USD/JPY/BHD/CHF/RUB, отрицательные) и 5 для convert()
- tests/test_excel_sync.py: TestExcelRoundTripByValues — round-trip по
значениям всех 6 листов + ModelInfo, 7 листов в файле
Проверено мутацией: смена режима округления роняет 11 тестов test_currency.py.
|
2026-10-25 05:17:32 +03:00 |
|
oqyude
|
d58547e8f8
|
T8: ISO 4217 per-currency decimals + format_money()
- Add CURRENCY_DECIMALS dict (JPY=0, BHD/KWD/OMR=3, rest=2) and DEFAULT_CURRENCY_DECIMALS=2
- Add CurrencyConverter.format_money() staticmethod with ROUND_HALF_UP; symbol-prefix for known, code-prefix for unknown
- Replace 14 :,.2f literals across services.py / info.py / config_cmd.py with format_money() calls
- Refactor 2 i18n templates (transaction_add.ok, recurring_add.ok): {amount:.2f} -> {amount_str}; callers pass pre-formatted string
- New _account_currency() helper for transaction currency lookup
- Extend test_currency.py: 8 new tests (JPY/BHD/USD/CHF/negative/zero/float-int/lowercase)
- 75/75 tests pass; 0 :,.2f literals remain in infrastructure/cli/
|
2026-10-09 19:24:47 +03:00 |
|
oqyude
|
c765f3672a
|
T2: Pydantic v2 — replace @dataclass with BaseModel
- All domain models now use pydantic.BaseModel
- Removed manual to_dict()/from_dict() — use model_dump(mode='json')/model_validate()
- Added field validators:
- Account.balance >= 0
- Transaction.amount != 0
- RecurringCashflow.amount != 0, frequency in {daily, weekly, monthly, yearly}
- Liability.interest, payment >= 0
- ExchangeRate.rate > 0
- ForecastScenario.multipliers >= 0
- pydantic v2 native UUID handling (auto str in JSON)
- Updated excel_sync.py to use model_validate()
- Updated tests/test_model.py and tests/test_currency.py
- Added pydantic>=2.0 to pyproject.toml
Tests: 63/63 pass.
|
2026-10-08 16:42:04 +03:00 |
|
oqyude
|
feb77ef217
|
T1: restructure to domain/application/infrastructure + schema version 1
- Move cashflow_model/ -> domain/
- Move engine/ -> application/
- Move cli/, sync/, ai/ -> infrastructure/
- Update all imports across codebase and tests
- Add version=1 to FinancialModel.to_dict() with migration hook in from_dict
- Update pyproject.toml: cf entry point and packages.find
Tests: 63/63 pass.
|
2026-10-08 16:34:10 +03:00 |
|