Skip to content

Commit

Permalink
Modify CFF tests to be consistent with CFX zone refactoring (#1286)
Browse files Browse the repository at this point in the history
* Modify CFF tests to be consistent with CFX zone refactoring

* Update the PR : don't break retro compatibility
  • Loading branch information
MichaelNale authored Nov 22, 2023
1 parent 9ca4c36 commit df3e45d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ def return_ds(server=None):
return return_ds


SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_8_0 = meets_version(
get_server_version(core._global_server()), "8.0"
)
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_1 = meets_version(
get_server_version(core._global_server()), "7.1"
)
Expand Down
54 changes: 30 additions & 24 deletions tests/test_resultinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_5_0,
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,
)

if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_5_0:
Expand Down Expand Up @@ -88,30 +89,35 @@ 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"
# 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
# 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_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"
Expand Down

0 comments on commit df3e45d

Please sign in to comment.