@@ -152,9 +152,11 @@ def test_update_various_fluids_matches_with_coolprop(self, name: FluidsList):
152
152
)
153
153
assert all (
154
154
[
155
- True
156
- if actual [i ] is None and expected [i ] is None
157
- else abs (actual [i ] - expected [i ]) < 1e-9
155
+ (
156
+ True
157
+ if actual [i ] is None and expected [i ] is None
158
+ else abs (actual [i ] - expected [i ]) < 1e-9
159
+ )
158
160
for i in range (len (actual ))
159
161
]
160
162
)
@@ -170,10 +172,34 @@ def test_specify_phase_always_specifies_phase_for_all_further_calculations(self)
170
172
self .fluid .specify_phase (Phases .Gas )
171
173
with pytest .raises (ValueError ):
172
174
self .fluid .update (Input .pressure (101325 ), Input .temperature (20 ))
175
+ with pytest .raises (ValueError ):
176
+ self .fluid .with_state (Input .pressure (101325 ), Input .temperature (20 ))
173
177
self .fluid .unspecify_phase ()
174
178
self .fluid .update (
175
179
Input .pressure (101325 ), Input .temperature (20 )
176
180
) # does not raise
181
+ self .fluid .with_state (
182
+ Input .pressure (101325 ), Input .temperature (20 )
183
+ ) # does not raise
184
+
185
+ def test_specify_phase_always_with_methods_chaining_works_same_way (self ):
186
+ with pytest .raises (ValueError ):
187
+ self .fluid .specify_phase (Phases .Gas ).update (
188
+ Input .pressure (101325 ), Input .temperature (20 )
189
+ )
190
+ self .fluid .unspecify_phase ()
191
+ with pytest .raises (ValueError ):
192
+ self .fluid .specify_phase (Phases .Gas ).with_state (
193
+ Input .pressure (101325 ), Input .temperature (20 )
194
+ )
195
+ self .fluid .specify_phase (Phases .Gas )
196
+ self .fluid .unspecify_phase ().update (
197
+ Input .pressure (101325 ), Input .temperature (20 )
198
+ ) # does not raise
199
+ self .fluid .specify_phase (Phases .Gas )
200
+ self .fluid .unspecify_phase ().with_state (
201
+ Input .pressure (101325 ), Input .temperature (20 )
202
+ ) # does not raise
177
203
178
204
def test_equals_same_returns_true (self ):
179
205
origin = self .fluid .with_state (Input .pressure (101325 ), Input .temperature (5 ))
0 commit comments