33import pytest
44
55from ecalc_neqsim_wrapper .thermo import NeqsimFluid
6- from libecalc .domain .process .value_objects .fluid_stream .fluid_model import EoSModel
6+ from libecalc .domain .process .value_objects .fluid_stream .fluid_model import EoSModel , FluidModel
77from libecalc .domain .process .value_objects .fluid_stream .process_conditions import ProcessConditions
88from libecalc .infrastructure .neqsim_fluid_provider .neqsim_thermo_system import NeqSimThermoSystem
99
@@ -15,9 +15,8 @@ def test_initialization_creates_neqsim_fluid(self, medium_composition):
1515 """Test that initialization creates a NeqsimFluid object internally."""
1616 with patch .object (NeqsimFluid , "create_thermo_system" , return_value = Mock ()) as mock_create :
1717 conditions = ProcessConditions (pressure_bara = 10.0 , temperature_kelvin = 300.0 )
18- thermo_system = NeqSimThermoSystem (
19- composition = medium_composition , eos_model = EoSModel .SRK , conditions = conditions
20- )
18+ fluid_model = FluidModel (composition = medium_composition , eos_model = EoSModel .SRK )
19+ thermo_system = NeqSimThermoSystem (fluid_model = fluid_model , conditions = conditions )
2120
2221 # Check NeqsimFluid.create_thermo_system was called with correct arguments
2322 # Note: composition is normalized before being passed to create_thermo_system
@@ -38,11 +37,10 @@ def test_initialization_with_neqsim_fluid(self, medium_composition):
3837 """Test initialization with a provided NeqsimFluid object."""
3938 mock_fluid = Mock ()
4039 conditions = ProcessConditions (pressure_bara = 10.0 , temperature_kelvin = 300.0 )
40+ fluid_model = FluidModel (composition = medium_composition , eos_model = EoSModel .SRK )
4141
4242 with patch .object (NeqsimFluid , "create_thermo_system" , return_value = Mock ()) as mock_create :
43- thermo_system = NeqSimThermoSystem (
44- composition = medium_composition , eos_model = EoSModel .SRK , conditions = conditions , neqsim_fluid = mock_fluid
45- )
43+ thermo_system = NeqSimThermoSystem (fluid_model = fluid_model , conditions = conditions , neqsim_fluid = mock_fluid )
4644
4745 # Check that create_thermo_system was not called
4846 mock_create .assert_not_called ()
@@ -54,7 +52,7 @@ def test_immutability(self, medium_composition):
5452 """Test that NeqSimThermoSystem attributes are effectively immutable."""
5553 conditions = ProcessConditions (pressure_bara = 10.0 , temperature_kelvin = 300.0 )
5654 thermo_system = NeqSimThermoSystem (
57- composition = medium_composition , eos_model = EoSModel .SRK , conditions = conditions
55+ fluid_model = FluidModel ( composition = medium_composition , eos_model = EoSModel .SRK ) , conditions = conditions
5856 )
5957
6058 # Attempting to modify public property attributes should raise an exception
@@ -102,7 +100,7 @@ def test_properties_cache(self, medium_composition):
102100 # Create the thermo system
103101 conditions = ProcessConditions (pressure_bara = 10.0 , temperature_kelvin = 300.0 )
104102 thermo_system = NeqSimThermoSystem (
105- composition = medium_composition , eos_model = EoSModel .SRK , conditions = conditions
103+ fluid_model = FluidModel ( composition = medium_composition , eos_model = EoSModel .SRK ) , conditions = conditions
106104 )
107105
108106 # Access properties multiple times - should only compute once
@@ -136,7 +134,8 @@ def test_flash_to_conditions(self, medium_composition):
136134 # Create the original thermo system
137135 original_conditions = ProcessConditions (pressure_bara = 10.0 , temperature_kelvin = 300.0 )
138136 original_thermo = NeqSimThermoSystem (
139- composition = medium_composition , eos_model = EoSModel .SRK , conditions = original_conditions
137+ fluid_model = FluidModel (composition = medium_composition , eos_model = EoSModel .SRK ),
138+ conditions = original_conditions ,
140139 )
141140
142141 # Test with remove_liquid=False to preserve composition
@@ -170,8 +169,7 @@ def test_integration_properties_at_conditions(self, medium_composition):
170169 temperature = 400.0
171170 conditions = ProcessConditions (pressure_bara = pressure , temperature_kelvin = temperature )
172171 thermo_system = NeqSimThermoSystem (
173- composition = medium_composition ,
174- eos_model = EoSModel .SRK ,
172+ fluid_model = FluidModel (composition = medium_composition , eos_model = EoSModel .SRK ),
175173 conditions = conditions ,
176174 )
177175
@@ -191,8 +189,7 @@ def test_direct_vs_property_access(self, medium_composition):
191189 temperature = 400.0
192190 conditions = ProcessConditions (pressure_bara = pressure , temperature_kelvin = temperature )
193191 thermo_system = NeqSimThermoSystem (
194- composition = medium_composition ,
195- eos_model = EoSModel .SRK ,
192+ fluid_model = FluidModel (composition = medium_composition , eos_model = EoSModel .SRK ),
196193 conditions = conditions ,
197194 )
198195
0 commit comments