Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 90 additions & 56 deletions tests/test_resultinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0,
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_1,
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0,
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0,
)

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


# @pytest.mark.skipif(
# not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, reason="Available with CFF starting 7.0"
# )
# def test_print_available_result_with_qualifiers(cfx_heating_coil, server_type):
# model = Model(cfx_heating_coil(server=server_type), server=server_type)
# ref = """DPF Result
# ----------
# specific_heat
# Operator name: "CP"
# Number of components: 1
# Dimensionality: scalar
# Homogeneity: specific_heat
# Units: J/kg*K^-1
# Location: Nodal
# Available qualifier labels:""" # noqa: E501
# ref2 = "'phase': 2"
# if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
# ref3 = "'zone': 11"
# else:
# ref3 = "'zone': 5"
# ar = model.metadata.result_info.available_results[0]
# got = str(ar)
# assert ref in got
# assert ref2 in got
# assert ref3 in got
# if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
# assert len(ar.qualifier_combinations) == 18
# else:
# assert len(ar.qualifier_combinations) == 20


# @pytest.mark.skipif(
# not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, reason="Available with CFF starting 7.0"
# )
# def test_print_result_info_with_qualifiers(cfx_heating_coil, server_type):
# model = Model(cfx_heating_coil(server=server_type), server=server_type)
# ref = """Static analysis
# Unit system: SI: m, kg, N, s, V, A, K
# Physics Type: Fluid
# Available results:
# - specific_heat: Nodal Specific Heat
# - epsilon: Nodal Epsilon
# - enthalpy: Nodal Enthalpy
# - turbulent_kinetic_energy: Nodal Turbulent Kinetic Energy
# - thermal_conductivity: Nodal Thermal Conductivity
# - dynamic_viscosity: Nodal Dynamic Viscosity
# - turbulent_viscosity: Nodal Turbulent Viscosity
# - static_pressure: Nodal Static Pressure
# - total_pressure: Nodal Total Pressure
# - density: Nodal Density
# - entropy: Nodal Entropy
# - temperature: Nodal Temperature
# - total_temperature: Nodal Total Temperature
# - velocity: Nodal Velocity
# Available qualifier labels:""" # noqa
# assert ref in str(model.metadata.result_info)
@pytest.mark.skipif(
not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, reason="Available with CFF starting 7.0"
)
def test_print_available_result_with_qualifiers(cfx_heating_coil, server_type):
model = Model(cfx_heating_coil(server=server_type), server=server_type)
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0:
ref = """DPF Result
----------
specific_heat
Operator name: "CP"
Number of components: 1
Dimensionality: scalar
Homogeneity: specific_heat
Units: J/kg*dK^-1
Location: Nodal
Available qualifier labels:""" # noqa: E501
else:
ref = """DPF Result
----------
specific_heat
Operator name: "CP"
Number of components: 1
Dimensionality: scalar
Homogeneity: specific_heat
Units: J/kg*K^-1
Location: Nodal
Available qualifier labels:""" # noqa: E501
ref2 = "'phase': 2"
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
ref3 = "'zone': 11"
else:
ref3 = "'zone': 5"
ar = model.metadata.result_info.available_results[0]
got = str(ar)
assert ref in got
assert ref2 in got
assert ref3 in got
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0:
assert len(ar.qualifier_combinations) == 18
else:
assert len(ar.qualifier_combinations) == 20


@pytest.mark.skipif(
not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0, reason="Available with CFF starting 7.0"
)
def test_print_result_info_with_qualifiers(cfx_heating_coil, server_type):
model = Model(cfx_heating_coil(server=server_type), server=server_type)
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_10_0:
ref = """Static analysis
Unit system: Custom: m, kg, N, s, V, A, K
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheoMeunierAnsys I' sorry I do not see the difference with the initial reference

Physics Type: Fluid
Available results:
- specific_heat: Nodal Specific Heat
- epsilon: Nodal Epsilon
- enthalpy: Nodal Enthalpy
- turbulent_kinetic_energy: Nodal Turbulent Kinetic Energy
- thermal_conductivity: Nodal Thermal Conductivity
- dynamic_viscosity: Nodal Dynamic Viscosity
- turbulent_viscosity: Nodal Turbulent Viscosity
- static_pressure: Nodal Static Pressure
- total_pressure: Nodal Total Pressure
- density: Nodal Density
- entropy: Nodal Entropy
- temperature: Nodal Temperature
- total_temperature: Nodal Total Temperature
- velocity: Nodal Velocity
Available qualifier labels:""" # noqa
else:
ref = """Static analysis
Unit system: SI: m, kg, N, s, V, A, K
Physics Type: Fluid
Available results:
- specific_heat: Nodal Specific Heat
- epsilon: Nodal Epsilon
- enthalpy: Nodal Enthalpy
- turbulent_kinetic_energy: Nodal Turbulent Kinetic Energy
- thermal_conductivity: Nodal Thermal Conductivity
- dynamic_viscosity: Nodal Dynamic Viscosity
- turbulent_viscosity: Nodal Turbulent Viscosity
- static_pressure: Nodal Static Pressure
- total_pressure: Nodal Total Pressure
- density: Nodal Density
- entropy: Nodal Entropy
- temperature: Nodal Temperature
- total_temperature: Nodal Total Temperature
- velocity: Nodal Velocity
Available qualifier labels:""" # noqa
assert ref in str(model.metadata.result_info)


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