summaryrefslogtreecommitdiff
path: root/finance/test_income.py
blob: fc75befb7818c600c1616c7a12e13f3bfaf83b8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from datetime import datetime
from decimal import Decimal

from finance import income


def test_income_integration() -> None:
    inc = income.Income(amount=Decimal(3000.0))

    tests = (
        (datetime(2024, 3, 12), datetime(2024, 4, 2), Decimal(3000.0)),
        (datetime(2024, 3, 1), datetime(2024, 3, 15), Decimal(3000.0)),
        (datetime(2024, 2, 25), datetime(2024, 3, 1), Decimal(3000.0)),
        (datetime(2024, 2, 25), datetime(2024, 6, 12), Decimal(12000.0)),
    )

    for test in tests:
        assert inc.integrate(start=test[0], end=test[1]) == test[2]