Skip to content

Commit d24ca5d

Browse files
Adapt to Units improvement and Temperature Difference handling (#2073)
* Adapt units symbol for temperature difference * Adapt unit test for unit system name * Handle retro compatibility * Fix reference
1 parent f7be394 commit d24ca5d

File tree

1 file changed

+90
-56
lines changed

1 file changed

+90
-56
lines changed

tests/test_resultinfo.py

Lines changed: 90 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0,
3131
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_1,
3232
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0,
33+
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0,
3334
)
3435

3536
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_5_0:
@@ -112,62 +113,95 @@ def test_repr_available_results_list(model):
112113
assert dpf.core.result_info.available_result.AvailableResult.__name__ in str(ar)
113114

114115

115-
# @pytest.mark.skipif(
116-
# not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, reason="Available with CFF starting 7.0"
117-
# )
118-
# def test_print_available_result_with_qualifiers(cfx_heating_coil, server_type):
119-
# model = Model(cfx_heating_coil(server=server_type), server=server_type)
120-
# ref = """DPF Result
121-
# ----------
122-
# specific_heat
123-
# Operator name: "CP"
124-
# Number of components: 1
125-
# Dimensionality: scalar
126-
# Homogeneity: specific_heat
127-
# Units: J/kg*K^-1
128-
# Location: Nodal
129-
# Available qualifier labels:""" # noqa: E501
130-
# ref2 = "'phase': 2"
131-
# if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
132-
# ref3 = "'zone': 11"
133-
# else:
134-
# ref3 = "'zone': 5"
135-
# ar = model.metadata.result_info.available_results[0]
136-
# got = str(ar)
137-
# assert ref in got
138-
# assert ref2 in got
139-
# assert ref3 in got
140-
# if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
141-
# assert len(ar.qualifier_combinations) == 18
142-
# else:
143-
# assert len(ar.qualifier_combinations) == 20
144-
145-
146-
# @pytest.mark.skipif(
147-
# not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, reason="Available with CFF starting 7.0"
148-
# )
149-
# def test_print_result_info_with_qualifiers(cfx_heating_coil, server_type):
150-
# model = Model(cfx_heating_coil(server=server_type), server=server_type)
151-
# ref = """Static analysis
152-
# Unit system: SI: m, kg, N, s, V, A, K
153-
# Physics Type: Fluid
154-
# Available results:
155-
# - specific_heat: Nodal Specific Heat
156-
# - epsilon: Nodal Epsilon
157-
# - enthalpy: Nodal Enthalpy
158-
# - turbulent_kinetic_energy: Nodal Turbulent Kinetic Energy
159-
# - thermal_conductivity: Nodal Thermal Conductivity
160-
# - dynamic_viscosity: Nodal Dynamic Viscosity
161-
# - turbulent_viscosity: Nodal Turbulent Viscosity
162-
# - static_pressure: Nodal Static Pressure
163-
# - total_pressure: Nodal Total Pressure
164-
# - density: Nodal Density
165-
# - entropy: Nodal Entropy
166-
# - temperature: Nodal Temperature
167-
# - total_temperature: Nodal Total Temperature
168-
# - velocity: Nodal Velocity
169-
# Available qualifier labels:""" # noqa
170-
# assert ref in str(model.metadata.result_info)
116+
@pytest.mark.skipif(
117+
not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, reason="Available with CFF starting 7.0"
118+
)
119+
def test_print_available_result_with_qualifiers(cfx_heating_coil, server_type):
120+
model = Model(cfx_heating_coil(server=server_type), server=server_type)
121+
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0:
122+
ref = """DPF Result
123+
----------
124+
specific_heat
125+
Operator name: "CP"
126+
Number of components: 1
127+
Dimensionality: scalar
128+
Homogeneity: specific_heat
129+
Units: J/kg*dK^-1
130+
Location: Nodal
131+
Available qualifier labels:""" # noqa: E501
132+
else:
133+
ref = """DPF Result
134+
----------
135+
specific_heat
136+
Operator name: "CP"
137+
Number of components: 1
138+
Dimensionality: scalar
139+
Homogeneity: specific_heat
140+
Units: J/kg*K^-1
141+
Location: Nodal
142+
Available qualifier labels:""" # noqa: E501
143+
ref2 = "'phase': 2"
144+
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
145+
ref3 = "'zone': 11"
146+
else:
147+
ref3 = "'zone': 5"
148+
ar = model.metadata.result_info.available_results[0]
149+
got = str(ar)
150+
assert ref in got
151+
assert ref2 in got
152+
assert ref3 in got
153+
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
154+
assert len(ar.qualifier_combinations) == 18
155+
else:
156+
assert len(ar.qualifier_combinations) == 20
157+
158+
159+
@pytest.mark.skipif(
160+
not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, reason="Available with CFF starting 7.0"
161+
)
162+
def test_print_result_info_with_qualifiers(cfx_heating_coil, server_type):
163+
model = Model(cfx_heating_coil(server=server_type), server=server_type)
164+
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0:
165+
ref = """Static analysis
166+
Unit system: Custom: m, kg, N, s, V, A, K
167+
Physics Type: Fluid
168+
Available results:
169+
- specific_heat: Nodal Specific Heat
170+
- epsilon: Nodal Epsilon
171+
- enthalpy: Nodal Enthalpy
172+
- turbulent_kinetic_energy: Nodal Turbulent Kinetic Energy
173+
- thermal_conductivity: Nodal Thermal Conductivity
174+
- dynamic_viscosity: Nodal Dynamic Viscosity
175+
- turbulent_viscosity: Nodal Turbulent Viscosity
176+
- static_pressure: Nodal Static Pressure
177+
- total_pressure: Nodal Total Pressure
178+
- density: Nodal Density
179+
- entropy: Nodal Entropy
180+
- temperature: Nodal Temperature
181+
- total_temperature: Nodal Total Temperature
182+
- velocity: Nodal Velocity
183+
Available qualifier labels:""" # noqa
184+
else:
185+
ref = """Static analysis
186+
Unit system: SI: m, kg, N, s, V, A, K
187+
Physics Type: Fluid
188+
Available results:
189+
- specific_heat: Nodal Specific Heat
190+
- epsilon: Nodal Epsilon
191+
- enthalpy: Nodal Enthalpy
192+
- turbulent_kinetic_energy: Nodal Turbulent Kinetic Energy
193+
- thermal_conductivity: Nodal Thermal Conductivity
194+
- dynamic_viscosity: Nodal Dynamic Viscosity
195+
- turbulent_viscosity: Nodal Turbulent Viscosity
196+
- static_pressure: Nodal Static Pressure
197+
- total_pressure: Nodal Total Pressure
198+
- density: Nodal Density
199+
- entropy: Nodal Entropy
200+
- temperature: Nodal Temperature
201+
- total_temperature: Nodal Total Temperature
202+
- velocity: Nodal Velocity
203+
Available qualifier labels:""" # noqa
204+
assert ref in str(model.metadata.result_info)
171205

172206

173207
@pytest.mark.skipif(True, reason="Used to test memory leaks")

0 commit comments

Comments
 (0)