@@ -591,12 +591,12 @@ def assertHasLogRecordWithMessage(logs_, message):
591
591
)
592
592
593
593
def test_discount_initial_year_cashflow (self ):
594
- def _get_result (do_discount : bool ) -> GeophiresXResult :
594
+ def _get_result (base_example : str , do_discount : bool ) -> GeophiresXResult :
595
595
return GeophiresXClient ().get_geophires_result (
596
596
GeophiresInputParameters (
597
597
# TODO switch over to generic EGS case to avoid thrash from example updates
598
598
# from_file_path=self._get_test_file_path('geophires_x_tests/generic-egs-case.txt'),
599
- from_file_path = self ._get_test_file_path ('examples/Fervo_Project_Cape-3 .txt' ),
599
+ from_file_path = self ._get_test_file_path (f 'examples/{ base_example } .txt' ),
600
600
params = {
601
601
'Discount Initial Year Cashflow' : do_discount ,
602
602
},
@@ -606,8 +606,28 @@ def _get_result(do_discount: bool) -> GeophiresXResult:
606
606
def _npv (r : GeophiresXResult ) -> dict :
607
607
return r .result ['ECONOMIC PARAMETERS' ]['Project NPV' ]['value' ]
608
608
609
- self .assertEqual (4580.36 , _npv (_get_result (False )))
610
- self .assertEqual (4280.71 , _npv (_get_result (True )))
609
+ self .assertEqual (4580.36 , _npv (_get_result ('Fervo_Project_Cape-3' , False )))
610
+ self .assertEqual (4280.71 , _npv (_get_result ('Fervo_Project_Cape-3' , True )))
611
+
612
+ def _extended_economics_npv (r : GeophiresXResult ) -> dict :
613
+ return r .result ['EXTENDED ECONOMICS' ]['Project NPV (including AddOns)' ]['value' ]
614
+
615
+ add_ons_result_without_discount = _get_result ('example1_addons' , False )
616
+ add_ons_result_with_discount = _get_result ('example1_addons' , True )
617
+
618
+ self .assertGreater (_npv (add_ons_result_without_discount ), _npv (add_ons_result_with_discount ))
619
+
620
+ ee_npv_without_discount = _extended_economics_npv (add_ons_result_without_discount )
621
+ assert ee_npv_without_discount < 0 , (
622
+ 'Test is expecting example1_addons extended economics NPV to be negative '
623
+ 'as a precondition - if this error is encountered, '
624
+ 'create a test-only copy of the previous version of example1_addons and '
625
+ 'use it in this test (like geophires_x_tests/generic-egs-case.txt).'
626
+ )
627
+
628
+ # Discounting first year causes negative NPVs to be less negative (according to Google Sheets,
629
+ # which was used to manually validate the expected NPVs here).
630
+ self .assertLess (ee_npv_without_discount , _extended_economics_npv (add_ons_result_with_discount ))
611
631
612
632
def test_transmission_pipeline_cost (self ):
613
633
result = GeophiresXClient ().get_geophires_result (
0 commit comments