Skip to content

Commit

Permalink
WIP on feat/libuserd_v2_phase1 (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
randallfrank authored Dec 30, 2024
1 parent bbc0f7c commit d303099
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 2 additions & 0 deletions doc/source/libuserd_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ uses a USERD interface can be read using this API.
ansys.pyensight.core.libuserd.Query
ansys.pyensight.core.libuserd.LibUserdError
ansys.pyensight.core.libuserd.ErrorCodes
ansys.pyensight.core.libuserd.UpdateHints
ansys.pyensight.core.libuserd.RankValues

22 changes: 10 additions & 12 deletions tests/unit_tests/test_session.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit tests for session.py"""
import fnmatch
import platform
from unittest import mock
import webbrowser
Expand Down Expand Up @@ -221,24 +222,21 @@ def test_convert_ctor(mocked_session, mocker):
assert value == "session.ensight.objs.ENS_GLOBALS(session, 221)"
cmd = mocker.patch.object(session, "cmd", return_value=0)
value = session._convert_ctor("Class: ENS_PART, desc: 'Sphere', CvfObjID: 1078, cached:no")
# Note: 1610612795 == ensight.objs.enums.PARTTYPE
assert (
value
== "session.ensight.objs.ENS_PART_MODEL(session, 1078,attr_id=1610612795, attr_value=0)"
# Note: attr_id=ensight.objs.enums.PARTTYPE
assert fnmatch.fnmatch(
value, "session.ensight.objs.ENS_PART_MODEL(session, 1078,attr_id=*, attr_value=0)"
)
cmd.return_value = 3
value = session._convert_ctor("Class: ENS_ANNOT, desc: 'Pressure', CvfObjID: 4761, cached:no")
# Note: 1610612996 == ensight.objs.enums.ANNOTTYPE
assert (
value
== "session.ensight.objs.ENS_ANNOT_LGND(session, 4761,attr_id=1610612996, attr_value=3)"
# Note: attr_id=ensight.objs.enums.ANNOTTYPE
assert fnmatch.fnmatch(
value, "session.ensight.objs.ENS_ANNOT_LGND(session, 4761,attr_id=*, attr_value=3)"
)
cmd.return_value = 6
value = session._convert_ctor("Class: ENS_TOOL, desc: 'Sphere', CvfObjID: 763, cached:no")
# Note: 1610613036 == ensight.objs.enums.TOOLTYPE
assert (
value
== "session.ensight.objs.ENS_TOOL_SPHERE(session, 763,attr_id=1610613036, attr_value=6)"
# Note: attr_id=ensight.objs.enums.TOOLTYPE
assert fnmatch.fnmatch(
value, "session.ensight.objs.ENS_TOOL_SPHERE(session, 763,attr_id=*, attr_value=6)"
)
session._ensobj_hash = {i: i for i in range(10000000)}
value = session._convert_ctor("Class: ENS_GLOBALS, CvfObjID: 221, cached:yes")
Expand Down

0 comments on commit d303099

Please sign in to comment.