Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
7 changes: 7 additions & 0 deletions src/ansys/dpf/core/available_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ class AvailableResult:
>>> transient = examples.download_transient_result()
>>> model = dpf.Model(transient)
>>> result_info = model.metadata.result_info
>>> res = result_info.available_results[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

@PProfizi Do we check docstrings in retro tests in CI Release? If we do that, this will fail. @oparreno alternatively we could get result by name here, and that would always work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rafacanton, I will verify once my PR is merged as I deleted that part in the first one

Copy link
Contributor

Choose a reason for hiding this comment

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

@rafacanton yes we do. And we have ways of making them retro-compatible, such as with a big ugly if on server.meets_version :).

>>> res.name
'displacement'
>>> res.homogeneity
'length'
>>> res.dimensionality
'vector'

Create the operator of the given available result.

Expand Down
5 changes: 5 additions & 0 deletions src/ansys/dpf/core/result_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ class ResultInfo:
>>> model = dpf.Model(transient)
>>> result_info = model.metadata.result_info # printable result_info

>>> result_info.available_results[1].name
'displacement'
>>> result_info.available_results[1].homogeneity
'length'

"""

def __init__(
Expand Down
21 changes: 12 additions & 9 deletions tests/test_resultinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,18 @@ def test_byitem_resultinfo(model):
assert res[0] is not None


# def test_get_result_resultinfo_from_index(model):
# res = model.metadata.result_info[3]
# assert res.name == "acceleration"
# assert res.n_components == 3
# assert res.dimensionality == "vector"
# assert res.homogeneity == "acceleration"
# assert res.unit == "m/s^2"
# assert res.name == "acceleration"
# assert res.qualifiers == []
def test_get_result_resultinfo_from_index(model):
if SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_11_0:
res = model.metadata.result_info[3]
else:
res = model.metadata.result_info[2]
assert res.name == "acceleration"
assert res.n_components == 3
assert res.dimensionality == "vector"
assert res.homogeneity == "acceleration"
assert res.unit == "m/s^2"
assert res.name == "acceleration"
assert res.qualifiers == []


def test_print_result_info(model):
Expand Down
Loading