Skip to content

Commit

Permalink
added null tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorb1 committed Oct 27, 2024
1 parent 2bcd28e commit af7dd63
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/results/test_results_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,13 @@ def test_calculate_captital_investment_no_dr_idv(

assert_frame_equal(actual, expected)

def test_null(self, null: ResultsPackage):
""" """
package = null
with raises(KeyError) as ex:
package.capital_investment()
assert "Cannot calculate CapitalInvestment due to missing data" in str(ex)


class TestDiscountedCapitalInvestment:
def test_calculate_discounted_captital_investment(
Expand Down Expand Up @@ -891,6 +898,16 @@ def test_calculate_discounted_captital_investment(

assert_frame_equal(actual, expected)

def test_null(self, null: ResultsPackage):
""" """
package = null
with raises(KeyError) as ex:
package.discounted_capital_investment()
assert (
"Cannot calculate DiscountedCapitalInvestment due to missing data"
in str(ex)
)


class TestDiscountedOperationalCost:
def test_calculate_discounted_operational_cost(
Expand Down Expand Up @@ -926,6 +943,15 @@ def test_calculate_discounted_operational_cost(

assert_frame_equal(actual, expected)

def test_null(self, null: ResultsPackage):
""" """
package = null
with raises(KeyError) as ex:
package.discounted_operational_cost()
assert "Cannot calculate DiscountedOperationalCost due to missing data" in str(
ex
)


class TestDiscountedCostByTechnology:
def test_calculate_discounted_cost_by_technology(
Expand Down Expand Up @@ -959,6 +985,15 @@ def test_calculate_discounted_cost_by_technology(

assert_frame_equal(actual, expected)

def test_null(self, null: ResultsPackage):
""" """
package = null
with raises(KeyError) as ex:
package.discounted_technology_cost()
assert "Cannot calculate DiscountedCostByTechnology due to missing data" in str(
ex
)


class TestTotalDiscountedCost:
def test_calculate_total_discounted_cost(
Expand All @@ -983,6 +1018,13 @@ def test_calculate_total_discounted_cost(

assert_frame_equal(actual, expected)

def test_null(self, null: ResultsPackage):
""" """
package = null
with raises(KeyError) as ex:
package.total_discounted_cost()
assert "Cannot calculate TotalDiscountedCost due to missing data" in str(ex)


class TestCapitalRecoveryFactor:
def test_crf(self, region, discount_rate_idv, operational_life):
Expand Down

0 comments on commit af7dd63

Please sign in to comment.