Skip to content

Commit 252a4ea

Browse files
WellDrillingCostCorrelation enum equality
1 parent 6b1b1b2 commit 252a4ea

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/geophires_x/OptionList.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ def __init__(self, idx: int, _: str, c2:float, c1:float, c0:float):
110110
self._c1 = c1
111111
self._c0 = c0
112112

113+
def __eq__(self, other):
114+
return str(self) == str(other)
115+
113116
def calculate_cost_MUSD(self, meters) -> float:
114117
return (self._c2 * meters ** 2 + self._c1 * meters + self._c0) * 1E-6
115118

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from base_test_case import BaseTestCase
2+
from geophires_x.OptionList import EndUseOptions
3+
from geophires_x.OptionList import PlantType
4+
from geophires_x.OptionList import WellDrillingCostCorrelation
5+
6+
7+
class EndUseOptionsTestCase(BaseTestCase):
8+
def test_get_end_use_option_from_input_string(self):
9+
self.assertEqual(EndUseOptions.get_end_use_option_from_input_string('1'), EndUseOptions.ELECTRICITY)
10+
11+
with self.assertRaises(ValueError):
12+
EndUseOptions.get_end_use_option_from_input_string('2034982309')
13+
14+
def test_equality(self):
15+
self.assertFalse(EndUseOptions.HEAT == EndUseOptions.ELECTRICITY)
16+
self.assertTrue(EndUseOptions.HEAT == EndUseOptions.HEAT)
17+
self.assertFalse(EndUseOptions.HEAT is None)
18+
self.assertTrue(EndUseOptions.HEAT is EndUseOptions.HEAT)
19+
# self.assertTrue(EndUseOptions.HEAT == 'HEAT')
20+
# self.assertFalse(EndUseOptions.HEAT == 'Electricity')
21+
22+
23+
class WellDrillingCostCorrelationTestCase(BaseTestCase):
24+
def test_equality(self):
25+
self.assertFalse(WellDrillingCostCorrelation.VERTICAL_SMALL == WellDrillingCostCorrelation.DEVIATED_SMALL)
26+
self.assertTrue(WellDrillingCostCorrelation.VERTICAL_SMALL == WellDrillingCostCorrelation.VERTICAL_SMALL)
27+
28+
29+
class PlantTypeTestCase(BaseTestCase):
30+
def test_equality(self):
31+
self.assertFalse(PlantType.SUB_CRITICAL_ORC == PlantType.SUPER_CRITICAL_ORC)
32+
self.assertTrue(WellDrillingCostCorrelation.VERTICAL_SMALL == WellDrillingCostCorrelation.VERTICAL_SMALL)

0 commit comments

Comments
 (0)