Skip to content

Commit

Permalink
Update testing
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Aug 11, 2023
1 parent 48b9464 commit ef2f50d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ def grpc_server():
server.shutdown()


SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_1 = meets_version(
get_server_version(core._global_server()), "7.1"
)

SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0 = meets_version(
get_server_version(core._global_server()), "7.0"
)
Expand Down
50 changes: 29 additions & 21 deletions tests/test_fluid_simulation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from ansys.dpf.core import examples
from conftest import SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0
from conftest import (
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_0,
SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_1,
)
import pytest
from pytest import fixture

Expand Down Expand Up @@ -162,26 +165,31 @@ def test_results_fluent_averaging_from_elemental_faces(self, fluent_simulation):
assert result._core_object[0].location == post.locations.nodal

# Request on faces (requires filter-out of cell zones)
with pytest.raises(
ValueError,
match="Querying an ElementalAndFaces result on "
"faces currently requires the use of face zone ids",
):
_ = fluent_simulation.static_pressure(location=post.locations.faces)
# print(result)
# assert result.index.mesh_index.location == post.locations.faces
# assert result._core_object[0].location == post.locations.faces
# result._fc[0].plot()
with pytest.raises(
ValueError,
match="Querying an ElementalAndFaces result on "
"faces currently requires the use of face zone ids",
):
_ = fluent_simulation.static_pressure_on_faces()
# print(result)
# assert result.index.mesh_index.location == post.locations.faces
# # assert result._core_object[0].location == post.locations.faces
# result.plot()
if not SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_7_1:
with pytest.raises(
ValueError,
match="Querying an ElementalAndFaces result on "
"faces currently requires the use of face zone ids",
):
_ = fluent_simulation.static_pressure(location=post.locations.faces)
with pytest.raises(
ValueError,
match="Querying an ElementalAndFaces result on "
"faces currently requires the use of face zone ids",
):
_ = fluent_simulation.static_pressure_on_faces()
else:
result = fluent_simulation.static_pressure(location=post.locations.faces)
# print(result)
assert result.index.mesh_index.location == post.locations.faces
assert result._core_object[0].location == post.locations.faces
# result._fc[0].plot()

result = fluent_simulation.static_pressure_on_faces()
# print(result)
assert result.index.mesh_index.location == post.locations.faces
assert result._core_object[0].location == post.locations.faces
# result.plot()

# Request on cells (requires filter-out of face zones)
result = fluent_simulation.static_pressure(location=post.locations.elemental)
Expand Down

0 comments on commit ef2f50d

Please sign in to comment.