def test_crf(): """ Tests whether the MVS is correctly calculating the capital recovery factor """ CRF = C2.crf(project_life, discount_factor) assert CRF == (discount_factor * (1 + discount_factor) ** project_life) / ( (1 + discount_factor) ** project_life - 1 )
CURR: "Euro", DISCOUNTFACTOR: {VALUE: 0.08}, PROJECT_DURATION: {VALUE: 20}, } DICT_ECONOMIC.update( { ANNUITY_FACTOR: { VALUE: C2.annuity_factor( project_life=DICT_ECONOMIC[PROJECT_DURATION][VALUE], discount_factor=DICT_ECONOMIC[DISCOUNTFACTOR][VALUE], ) }, CRF: { VALUE: C2.crf( project_life=DICT_ECONOMIC[PROJECT_DURATION][VALUE], discount_factor=DICT_ECONOMIC[DISCOUNTFACTOR][VALUE], ) }, } ) USE_CASE = "Economic_KPI_C2_E2" def process_expected_values(): """ Processes expected values from `test_data_economic_expected_values.csv`. Derive expected values dependent on actual dispatch of the asset(s) for asset in expected_values.columns:
VALUE: 20 }, } dict_economic.update({ ANNUITY_FACTOR: { VALUE: C2.annuity_factor( project_life=dict_economic[PROJECT_DURATION][VALUE], discount_factor=dict_economic[DISCOUNTFACTOR][VALUE], ) }, CRF: { VALUE: C2.crf( project_life=dict_economic[PROJECT_DURATION][VALUE], discount_factor=dict_economic[DISCOUNTFACTOR][VALUE], ) }, }) class Test_Economic_KPI: def setup_method(self): if os.path.exists(TEST_OUTPUT_PATH): shutil.rmtree(TEST_OUTPUT_PATH, ignore_errors=True) if os.path.exists(TEST_OUTPUT_PATH) is False: os.mkdir(TEST_OUTPUT_PATH) @mock.patch("argparse.ArgumentParser.parse_args", return_value=argparse.Namespace()) def test_benchmark_Economic_KPI_C2_E2(self, margs):