Skip to content

Commit

Permalink
total discounted costs test
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorb1 committed Oct 26, 2024
1 parent a26dc4b commit f86d313
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion tests/results/test_results_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,22 @@ def discounted_salvage_value():
return data


@fixture
def discounted_technology_cost():
data = pd.DataFrame(
data=[
["SIMPLICITY", "DUMMY", 2014, 111],
["SIMPLICITY", "DUMMY", 2015, 222],
["SIMPLICITY", "DUMMY", 2016, 333],
["SIMPLICITY", "GAS_EXTRACTION", 2014, 444],
["SIMPLICITY", "GAS_EXTRACTION", 2015, 555],
["SIMPLICITY", "GAS_EXTRACTION", 2016, 666],
],
columns=["REGION", "TECHNOLOGY", "YEAR", "VALUE"],
).set_index(["REGION", "TECHNOLOGY", "YEAR"])
return data


@fixture(scope="function")
def null() -> ResultsPackage:
package = ResultsPackage({})
Expand Down Expand Up @@ -912,7 +928,7 @@ def test_calculate_discounted_operational_cost(


class TestDiscountedCostByTechnology:
def test_calculate_discounted_operational_cost(
def test_calculate_discounted_cost_by_technology(
self,
discounted_capital_costs,
discounted_operational_costs,
Expand Down Expand Up @@ -944,6 +960,30 @@ def test_calculate_discounted_operational_cost(
assert_frame_equal(actual, expected)


class TestTotalDiscountedCost:
def test_calculate_total_discounted_cost(
self,
discounted_technology_cost,
):

results = {
"DiscountedCostByTechnology": discounted_technology_cost,
}

package = ResultsPackage(results)
actual = package.total_discounted_cost()
expected = pd.DataFrame(
data=[
["SIMPLICITY", 2014, 555],
["SIMPLICITY", 2015, 777],
["SIMPLICITY", 2016, 999],
],
columns=["REGION", "YEAR", "VALUE"],
).set_index(["REGION", "YEAR"])

assert_frame_equal(actual, expected)


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

Expand Down

0 comments on commit f86d313

Please sign in to comment.