summaryrefslogtreecommitdiff
path: root/finance/test_flow.py
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-09-08 12:46:20 +0200
committerxengineering <me@xengineering.eu>2024-09-08 17:21:32 +0200
commit7521277860b377e3e9ec7b6d5a62c4c2c14d694f (patch)
tree56dd44a017a9e5085fbbb0ae9efdf4f20551be13 /finance/test_flow.py
parent4e8d17c8d0b7d5406d3a9df8c320b5cbabb9d330 (diff)
downloadfinance-py-7521277860b377e3e9ec7b6d5a62c4c2c14d694f.tar
finance-py-7521277860b377e3e9ec7b6d5a62c4c2c14d694f.tar.zst
finance-py-7521277860b377e3e9ec7b6d5a62c4c2c14d694f.zip
Use list[tuple[datetime, Decimal]] consistently
This type is useful for finance-py in general. It is often required to handle money in datetime context. Using this type consistently makes the code easier to read and maintain.
Diffstat (limited to 'finance/test_flow.py')
-rw-r--r--finance/test_flow.py19
1 files changed, 7 insertions, 12 deletions
diff --git a/finance/test_flow.py b/finance/test_flow.py
index db1b695..91d189b 100644
--- a/finance/test_flow.py
+++ b/finance/test_flow.py
@@ -31,22 +31,17 @@ def test_flow_integration() -> None:
def test_simulate() -> None:
flows = (Flow(amount=Decimal(100.0), since=None, until=None),)
- dates, values = simulate(
+ simulated = 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),
+ expected = [
+ (datetime(2024, 1, 1), Decimal(100.0)),
+ (datetime(2024, 2, 1), Decimal(200.0)),
+ (datetime(2024, 3, 1), Decimal(300.0)),
+ (datetime(2024, 4, 1), Decimal(400.0)),
]
- assert values == [
- Decimal(100.0),
- Decimal(200.0),
- Decimal(300.0),
- Decimal(400.0),
- ]
+ assert simulated == expected