From 913703fb0af87321093635de8b7fb6f01fa71b8a Mon Sep 17 00:00:00 2001 From: Adarsh Murthy Date: Mon, 12 Jun 2017 17:49:04 -0400 Subject: [PATCH] Add 2 more test cases to balance sheet projection to see if Value error is raised when NOI or cash balance dictionary is empty. --- .../test_balance_sheet_projection.py | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/bpfin/tests/test_financials/test_balance_sheet_projection.py b/bpfin/tests/test_financials/test_balance_sheet_projection.py index fdf7813..383daea 100644 --- a/bpfin/tests/test_financials/test_balance_sheet_projection.py +++ b/bpfin/tests/test_financials/test_balance_sheet_projection.py @@ -1,9 +1,12 @@ +"""Tests for balance sheet projection.""" +import datetime +import pytest from bpfin.financials.balance_sheet_projection import balance_sheet_projection from bpfin.tests.testdata import sample_data as db -import datetime def test_balance_sheet_projection(): + """Test balance_sheet_projection function with sample data.""" input_cash_balance = db.cash_balance input_liability = db.liability_dictionary input_noi = db.noi_dictionary @@ -35,7 +38,26 @@ def test_balance_sheet_projection(): 2035: 1653669.0253920422, 2036: 1814938.615393169 } - result = balance_sheet_projection(input_cash_balance, input_liability, - input_noi, input_date_years) + result = balance_sheet_projection(input_cash_balance, input_liability, input_noi, input_date_years) assert output == result + +def test_balance_sheet_projection_2(): + """Test balance_sheet_projection function for NOI dictionary empty. This should raise a ValueError.""" + + input_cash_balance = db.cash_balance + input_liability = db.liability_dictionary + input_noi = {} + input_date_years = {datetime.date(2012, 1, 15): 25} + with pytest.raises(ValueError): + balance_sheet_projection(input_cash_balance, input_liability, input_noi, input_date_years) + +def test_balance_sheet_projection_3(): + """Test balance_sheet_projection function for cash balance dictionary empty. This should raise a ValueError.""" + + input_cash_balance = {} + input_liability = db.liability_dictionary + input_noi = db.noi_dictionary + input_date_years = {datetime.date(2012, 1, 15): 25} + with pytest.raises(ValueError): + balance_sheet_projection(input_cash_balance, input_liability, input_noi, input_date_years) -- GitLab