diff options
author | xengineering <me@xengineering.eu> | 2024-09-04 20:56:03 +0200 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2024-09-08 17:21:32 +0200 |
commit | 877b50ef8802f8b59d81ccabcab22fe185e898d7 (patch) | |
tree | fa322ebc22f146805ac085e82d5f2b575a5230d7 /finance/test_flow.py | |
parent | b85de39cd765164d5a31836cb7ca106ad6e328a7 (diff) | |
download | finance-py-877b50ef8802f8b59d81ccabcab22fe185e898d7.tar finance-py-877b50ef8802f8b59d81ccabcab22fe185e898d7.tar.zst finance-py-877b50ef8802f8b59d81ccabcab22fe185e898d7.zip |
Rename income to flow
Modeling income and expenses separately does not make sense since the
only difference is the sign of the amount. Separate definitions would
lead to a lot of duplicated code.
Diffstat (limited to 'finance/test_flow.py')
-rw-r--r-- | finance/test_flow.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/finance/test_flow.py b/finance/test_flow.py new file mode 100644 index 0000000..aad4e74 --- /dev/null +++ b/finance/test_flow.py @@ -0,0 +1,18 @@ +from datetime import datetime +from decimal import Decimal + +from finance import flow + + +def test_income_integration() -> None: + inc = flow.Flow(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] |