Skip to content

Commit

Permalink
fix: error on accessing global coeffcients data (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpbeing authored Sep 17, 2024
1 parent 4fdb9a3 commit 11cf7dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/ansys/simai/core/data/post_processings.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ def data(self) -> Dict[str, List]:
self.wait()

results = self._get_results()
return cast_values_to_float(results["data"]["values"])
return {
k: {**v, "data": cast_values_to_float(v["data"])}
for k, v in results["data"]["values"].items()
}


class SurfaceEvol(ExportablePostProcessing):
Expand Down
9 changes: 7 additions & 2 deletions tests/test_post_processings_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ def test_post_processing_result_global_coefficients(simai_client):
"X": 4.441544089820862,
"Y": 0.32894839148911376,
"Z": 14.442021446988662,
}
},
"type": "base",
"unit": {"N": 1},
},
"WallShearStress": {
"data": {
"X": -0.6887743615741067,
"Y": 0.08958696618025093,
"Z": 0.0741612935822976,
}
},
"type": "base",
"unit": {"N": 1},
},
}
},
Expand All @@ -88,6 +92,7 @@ def test_post_processing_result_global_coefficients(simai_client):
assert isinstance(global_coefficients.data, dict)
assert len(global_coefficients.data) == 2
assert global_coefficients.data["IsoStaticPressureForce"]["data"]["X"] == 4.441544089820862
assert global_coefficients.data["IsoStaticPressureForce"]["type"] == "base"

# check despite 2 access to global_coefficients.data, only 1 call to API endpoint
assert responses.assert_call_count("https://test.test/post-processings/7167", 1)
Expand Down

0 comments on commit 11cf7dd

Please sign in to comment.