Skip to content

Commit

Permalink
Adding unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Dec 15, 2023
1 parent cfa15ee commit e99b997
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,34 @@ def test_nlist_to_array(mapdl, beam_solve):
assert len(nlist.to_list()) == len(mapdl.mesh.nodes)
assert len(nlist.to_array()) == len(mapdl.mesh.nodes)
assert np.allclose(nlist.to_array()[:, 1:4], mapdl.mesh.nodes)


def test_cmlist(mapdl):
mapdl.prep7()
# setup the full file
mapdl.block(0, 1, 0, 1, 0, 1)
mapdl.et(1, 186)
mapdl.esize(0.5)
mapdl.vmesh("all")

mapdl.cm("myComp", "node")
mapdl.cm("_myComp", "node")
mapdl.cm("_myComp_", "node")

cmlist = mapdl.cmlist()
assert "MYCOMP" in cmlist

cmlist_all = mapdl.cmlist("all")
assert "_MYCOMP_" in cmlist_all
assert "_MYCOMP" in cmlist_all
assert "MYCOMP" in cmlist_all

assert ["MYCOMP"] == mapdl.cmlist().to_list()

assert "_MYCOMP_" in cmlist_all.to_list()
assert "_MYCOMP" in cmlist_all.to_list()
assert "MYCOMP" in cmlist_all.to_list()

assert len(cmlist_all.to_array()) == len(cmlist_all.to_list())
for each_ in cmlist_all.to_list():
assert each_ in cmlist_all

0 comments on commit e99b997

Please sign in to comment.