Skip to content

Commit

Permalink
Use assertListEqual instead of bare assert in client test case where …
Browse files Browse the repository at this point in the history
…applicable
  • Loading branch information
softwareengineerprogrammer committed Oct 17, 2023
1 parent 1b6519c commit 9a56834
Showing 1 changed file with 49 additions and 32 deletions.
81 changes: 49 additions & 32 deletions tests/test_geophires_x_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,31 +65,45 @@ def test_geophires_x_result_generation_profiles(self):

assert result.power_generation_profile is not None
assert len(result.power_generation_profile) == 36
assert result.power_generation_profile[0] == [
'YEAR',
'THERMAL DRAWDOWN',
'GEOFLUID TEMPERATURE (deg C)',
'PUMP POWER (MW)',
'NET POWER (MW)',
'NET HEAT (MW)',
'FIRST LAW EFFICIENCY (%)',
]
assert result.power_generation_profile[1] == [0, 1.0, 225.24, 0.1791, 20.597, 11.6711, 16.5771]
assert result.power_generation_profile[19] == [18, 0.9877, 222.47, 0.1791, 20.0002, 11.3001, 16.3717]
assert result.power_generation_profile[35] == [34, 0.9248, 208.31, 0.1791, 17.1102, 9.2569, 15.3214]
self.assertListEqual(
result.power_generation_profile[0],
[
'YEAR',
'THERMAL DRAWDOWN',
'GEOFLUID TEMPERATURE (deg C)',
'PUMP POWER (MW)',
'NET POWER (MW)',
'NET HEAT (MW)',
'FIRST LAW EFFICIENCY (%)',
],
)
self.assertListEqual(result.power_generation_profile[1], [0, 1.0, 225.24, 0.1791, 20.597, 11.6711, 16.5771])
self.assertListEqual(
result.power_generation_profile[19], [18, 0.9877, 222.47, 0.1791, 20.0002, 11.3001, 16.3717]
)
self.assertListEqual(
result.power_generation_profile[35], [34, 0.9248, 208.31, 0.1791, 17.1102, 9.2569, 15.3214]
)

assert result.heat_electricity_extraction_generation_profile is not None
assert len(result.heat_electricity_extraction_generation_profile) == 36
assert result.heat_electricity_extraction_generation_profile[0] == [
'YEAR',
'HEAT PROVIDED (GWh/year)',
'ELECTRICITY PROVIDED (GWh/year)',
'HEAT EXTRACTED (GWh/year)',
'RESERVOIR HEAT CONTENT (10^15 J)',
'PERCENTAGE OF TOTAL HEAT MINED (%)',
]
assert result.heat_electricity_extraction_generation_profile[1] == [1, 93.2, 164.4, 1090.2, 80.03, 4.67]
assert result.heat_electricity_extraction_generation_profile[-1] == [35, 72.5, 134.2, 958.47, -48.48, 157.75]
self.assertListEqual(
result.heat_electricity_extraction_generation_profile[0],
[
'YEAR',
'HEAT PROVIDED (GWh/year)',
'ELECTRICITY PROVIDED (GWh/year)',
'HEAT EXTRACTED (GWh/year)',
'RESERVOIR HEAT CONTENT (10^15 J)',
'PERCENTAGE OF TOTAL HEAT MINED (%)',
],
)
self.assertListEqual(
result.heat_electricity_extraction_generation_profile[1], [1, 93.2, 164.4, 1090.2, 80.03, 4.67]
)
self.assertListEqual(
result.heat_electricity_extraction_generation_profile[-1], [35, 72.5, 134.2, 958.47, -48.48, 157.75]
)

def test_ags_clgs_result_generation_profiles(self):
test_result_path = self._get_test_file_path('geophires-result_example-5.out')
Expand All @@ -109,19 +123,22 @@ def test_ags_clgs_result_generation_profiles(self):
],
)
self.assertListEqual(result.power_generation_profile[1], [1, 1.0000, 108.39, 0.0000, 0.2930, 9.5729])
assert result.power_generation_profile[-1] == [40, 0.8649, 96.86, 0.0000, 0.2070, 6.7646]
self.assertListEqual(result.power_generation_profile[-1], [40, 0.8649, 96.86, 0.0000, 0.2070, 6.7646])

assert result.heat_electricity_extraction_generation_profile is not None
assert len(result.heat_electricity_extraction_generation_profile) == 41
assert result.heat_electricity_extraction_generation_profile[0] == [
'YEAR',
'ELECTRICITY PROVIDED (GWh/year)',
'HEAT EXTRACTED (GWh/year)',
'RESERVOIR HEAT CONTENT (10^15 J)',
'PERCENTAGE OF TOTAL HEAT MINED (%)',
]
assert result.heat_electricity_extraction_generation_profile[1] == [1, 2.6, 30.1, 3.68, 2.86]
assert result.heat_electricity_extraction_generation_profile[-1] == [40, 1.8, 22.7, 0.32, 91.57]
self.assertListEqual(
result.heat_electricity_extraction_generation_profile[0],
[
'YEAR',
'ELECTRICITY PROVIDED (GWh/year)',
'HEAT EXTRACTED (GWh/year)',
'RESERVOIR HEAT CONTENT (10^15 J)',
'PERCENTAGE OF TOTAL HEAT MINED (%)',
],
)
self.assertListEqual(result.heat_electricity_extraction_generation_profile[1], [1, 2.6, 30.1, 3.68, 2.86])
self.assertListEqual(result.heat_electricity_extraction_generation_profile[-1], [40, 1.8, 22.7, 0.32, 91.57])

def test_input_hashing(self):
input1 = GeophiresInputParameters(
Expand Down

0 comments on commit 9a56834

Please sign in to comment.