From 24adcb0a3e017b26d9af9783505e2fdf2f535500 Mon Sep 17 00:00:00 2001 From: chenzheng06 Date: Mon, 15 May 2017 12:47:17 -0400 Subject: [PATCH 1/2] Create new test files for cash_balance_year. And need to fix cash_balance calculation --- .../test_financials/test_cash_balance.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/bpfin/tests/test_financials/test_cash_balance.py b/bpfin/tests/test_financials/test_cash_balance.py index fa1a08d..2f27f7b 100644 --- a/bpfin/tests/test_financials/test_cash_balance.py +++ b/bpfin/tests/test_financials/test_cash_balance.py @@ -2,6 +2,29 @@ from bpfin.financials.cash_balance import cash_balance from datetime import date +def test_cash_balance_year_gap(): + input_dictionary = { + date(2014, 11, 1): (500, False), + date(2014, 12, 1): (400, False), + date(2014, 3, 13): (600, False), + date(2016, 11, 11): (500, False), + date(2016, 12, 31): (400, True) + } + input_analysis_date = { + 'proforma_start': date(2012, 5, 3), + 'proforma_duration': 12 + } + output_cash_balance = { + 2012: 450, + 2013: 450, + 2014: 500, + 2015: 450, + 2016: 400 + } + result = cash_balance(input_analysis_date, input_dictionary) + assert result == output_cash_balance + + def test_cash_balance(): input_dictionary = { date(2014, 11, 1): (500, False), -- GitLab From 6dc30e00fb52c48c69903ca575a05082a37d49dc Mon Sep 17 00:00:00 2001 From: Sarey Hamarneh Date: Tue, 16 May 2017 14:04:02 -0400 Subject: [PATCH 2/2] refactor balance proj --- bpfin/financials/balance_sheet_projection.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bpfin/financials/balance_sheet_projection.py b/bpfin/financials/balance_sheet_projection.py index 54d8dcd..8c460f7 100644 --- a/bpfin/financials/balance_sheet_projection.py +++ b/bpfin/financials/balance_sheet_projection.py @@ -17,6 +17,11 @@ def balance_sheet_projection(cash_balance, liability, """ + if not noi_dict: + raise ValueError("NOI Dictionary is missing") + if not cash_balance: + raise ValueError("Cash Balance is missing") + analysis_years = {} for date in analysis_date: -- GitLab