Skip to content

Commit 3024ae2

Browse files
additional cases for test_fervo_project_red_2026_results_against_reference_values
1 parent 8bb5660 commit 3024ae2

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

tests/base_test_case.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import os.path
66
import sys
77
import unittest
8+
from typing import Any
9+
10+
from pint.facets.plain import PlainQuantity
811

912
from geophires_x.GeoPHIRESUtils import sig_figs
1013
from geophires_x_client import GeophiresInputParameters
@@ -154,3 +157,7 @@ def get_input_parameter(params: GeophiresInputParameters, param_name: str) -> fl
154157
return str(ret)
155158

156159
return None
160+
161+
@staticmethod
162+
def value_unit_as_quantity(v_u_entry: dict[str, Any]) -> PlainQuantity:
163+
return PlainQuantity(v_u_entry['value'], v_u_entry['unit'])

tests/geophires_x_tests/test_fervo_project_red_2026.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
from __future__ import annotations
22

3+
from typing import Any
4+
5+
from pint.facets.plain import PlainQuantity
6+
37
from base_test_case import BaseTestCase
48
from geophires_x_client import GeophiresInputParameters
59
from geophires_x_client import GeophiresXClient
@@ -12,9 +16,23 @@ def test_fervo_project_red_2026_results_against_reference_values(self):
1216
Asserts that results conform to some of the key reference values claimed in docs/Fervo_Project_Cape-4.md.
1317
"""
1418

19+
def _q(v: float, u: str) -> PlainQuantity:
20+
return PlainQuantity(v, u)
21+
22+
def _vuq(v_u: dict[str, Any]) -> PlainQuantity:
23+
return self.value_unit_as_quantity(v_u)
24+
1525
r = GeophiresXClient().get_geophires_result(
1626
GeophiresInputParameters(from_file_path=self._get_test_file_path('../examples/Fervo_Project_Red-2026.txt'))
1727
)
1828

19-
avg_pumping_power_mw = r.result['SURFACE EQUIPMENT SIMULATION RESULTS']['Average Pumping Power']['value']
20-
self.assertEqual(0.7, avg_pumping_power_mw)
29+
self.assertEqual(_q(0.7, 'MW'), _vuq(r.result['SURFACE EQUIPMENT SIMULATION RESULTS']['Average Pumping Power']))
30+
31+
self.assertLess(_vuq(r.result['SUMMARY OF RESULTS']['Average Net Electricity Production']), _q(2.0, 'MW'))
32+
33+
self.assertGreater(
34+
_vuq(r.result['RESERVOIR SIMULATION RESULTS']['Average Production Temperature']), _q(346, 'degF')
35+
)
36+
self.assertLess(
37+
_vuq(r.result['RESERVOIR SIMULATION RESULTS']['Average Production Temperature']), _q(356, 'degF')
38+
)

0 commit comments

Comments
 (0)