-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_humid_air_extended.py
38 lines (28 loc) · 1.17 KB
/
test_humid_air_extended.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from __future__ import annotations
from pyfluids import HumidAir, InputHumidAir
class HumidAirExtended(HumidAir):
"""An example of how to add new properties to the HumidAir class."""
def __init__(self):
super().__init__()
self.__specific_heat_const_volume: float | None = None
@property
def specific_heat_const_volume(self) -> float:
"""Mass specific constant volume specific heat [J/kg/K]."""
if self.__specific_heat_const_volume is None:
self.__specific_heat_const_volume = self._keyed_output("CVha")
return self.__specific_heat_const_volume
def factory(self) -> HumidAirExtended:
return HumidAirExtended()
def reset(self):
super().reset()
self.__specific_heat_const_volume = None
class TestHumidAirExtended:
humid_air = HumidAirExtended().with_state(
InputHumidAir.pressure(101325),
InputHumidAir.temperature(20),
InputHumidAir.relative_humidity(50),
)
def test_specific_heat_const_volume_humid_air_in_standard_conditions_returns_722(
self,
):
assert abs(self.humid_air.specific_heat_const_volume - 722.687189702383) < 1e-6