Skip to content

Commit

Permalink
fix: all test
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Nov 19, 2024
1 parent c0c9601 commit d43196d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions tests/test_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,21 +637,23 @@ def test_elem_disp(mapdl, static_solve, comp):
mapdl.set(1, 1, mute=True)
mapdl.allsel()

if comp == "all":
context = pytest.raises(
ValueError, match='"ALL" not allowed in this context'
)
else:
context = NullContext()
disp_from_grpc = mapdl.post_processing.element_displacement(comp)

with context:
disp_from_grpc = mapdl.post_processing.element_displacement(comp)

# use pretab to get the data
table_name = "values"
# use pretab to get the data
table_name = "values"
if comp != "all":
mapdl.etable(table_name, "U", comp, mute=True)
arr = np.genfromtxt(mapdl.pretab(table_name).splitlines()[1:])[:, 1]
assert np.allclose(arr, disp_from_grpc)
else:
arr = []
for direction in ["x", "y", "z"]:
mapdl.etable(table_name, "U", direction, mute=True)
arr.append(
np.genfromtxt(mapdl.pretab(table_name).splitlines()[1:])[:, 1]
)
arr = np.array(arr).T

assert np.allclose(arr, disp_from_grpc)

@staticmethod
@pytest.mark.parametrize("option", ["min", "max", "avg"])
Expand Down

0 comments on commit d43196d

Please sign in to comment.