summaryrefslogtreecommitdiff
path: root/finance/test_flow.py
diff options
context:
space:
mode:
Diffstat (limited to 'finance/test_flow.py')
-rw-r--r--finance/test_flow.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/finance/test_flow.py b/finance/test_flow.py
index 497c8d7..db1b695 100644
--- a/finance/test_flow.py
+++ b/finance/test_flow.py
@@ -1,11 +1,11 @@
from datetime import datetime
from decimal import Decimal
-from finance import flow
+from finance.flow import Flow, simulate
def test_flow_integration() -> None:
- fl = flow.Flow(
+ fl = Flow(
amount=Decimal(3000.0),
since=datetime(2023, 1, 1),
until=datetime(2026, 1, 5),
@@ -26,3 +26,27 @@ def test_flow_integration() -> None:
for test in tests:
assert fl.integrate(start=test[0], end=test[1]) == test[2]
+
+
+def test_simulate() -> None:
+ flows = (Flow(amount=Decimal(100.0), since=None, until=None),)
+
+ dates, values = simulate(
+ start=datetime(2024, 1, 1),
+ end=datetime(2024, 4, 1),
+ flows=flows,
+ )
+
+ assert dates == [
+ datetime(2024, 1, 1),
+ datetime(2024, 2, 1),
+ datetime(2024, 3, 1),
+ datetime(2024, 4, 1),
+ ]
+
+ assert values == [
+ Decimal(100.0),
+ Decimal(200.0),
+ Decimal(300.0),
+ Decimal(400.0),
+ ]