Skip to content

Commit

Permalink
feat: test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mkundu1 committed Oct 16, 2024
1 parent 9de91b4 commit 2f987d7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/ansys/fluent/core/solver/flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ def _get_new_keywords(obj, *args, **kwds):
newkwds[argName] = arg
if kwds:
# Convert deprecated keywords through aliases
# We don't get argument-aliases from static-info yet.
# We don't get arguments-aliases from static-info yet.
argument_aliases_scm = obj.get_attr("arguments-aliases") or {}
argument_aliases = {}
for k, v in argument_aliases_scm.items():
Expand Down Expand Up @@ -2143,8 +2143,8 @@ def _process_cls_names(info_dict, names, write_doc=False):
child_aliases = info.get("child-aliases") or info.get("child_aliases", {})
command_aliases = info.get("command-aliases") or info.get("command_aliases", {})
query_aliases = info.get("query-aliases") or info.get("query_aliases", {})
argument_aliases = info.get("argument-aliases") or info.get(
"argument_aliases", {}
argument_aliases = info.get("arguments-aliases") or info.get(
"arguments_aliases", {}
)
if child_aliases or command_aliases or query_aliases or argument_aliases:
cls._child_aliases = {}
Expand Down
5 changes: 5 additions & 0 deletions tests/test_flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ class Command(Setting):
# arguments = None
# cb = None

def __init__(self, parent):
self.attrs = super().attrs.copy()
self.attrs["arguments-aliases"] = lambda self: {}
super().__init__(parent)

def __call__(self, **kwds):
args = []
for k, v in self.arguments.items():
Expand Down
15 changes: 11 additions & 4 deletions tests/test_settings_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,12 @@ def test_wildcard(new_solver_session):


@pytest.mark.fluent_version(">=23.2")
def test_wildcard_fnmatch(mixing_elbow_case_data_session):
solver = mixing_elbow_case_data_session
def test_wildcard_fnmatch(new_solver_session):
solver = new_solver_session
case_path = download_file("elbow_source_terms.cas.h5", "pyfluent/mixing_elbow")
solver.file.read_case(file_name=case_path)

solver.solution.initialization.hybrid_initialize()

mesh = solver.results.graphics.mesh
assert mesh.create("mesh-a").name() == "mesh-a"
Expand All @@ -176,8 +180,10 @@ def test_wildcard_fnmatch(mixing_elbow_case_data_session):


@pytest.mark.fluent_version(">=23.2")
def test_wildcard_path_is_iterable(mixing_elbow_settings_session):
solver = mixing_elbow_settings_session
def test_wildcard_path_is_iterable(new_solver_session):
solver = new_solver_session
case_path = download_file("elbow_source_terms.cas.h5", "pyfluent/mixing_elbow")
solver.file.read(file_name=case_path, file_type="case", lightweight_setup=True)

velocity_inlet = solver.setup.boundary_conditions.velocity_inlet
assert [x for x in velocity_inlet] == ["inlet2", "inlet1"]
Expand Down Expand Up @@ -513,6 +519,7 @@ def test_commands_not_in_settings(new_solver_session):
getattr(solver.settings, command)


@pytest.mark.fluent_version(">=25.1")
def test_deprecated_command_arguments(mixing_elbow_case_data_session):
solver = mixing_elbow_case_data_session
with pytest.warns() as record:
Expand Down

0 comments on commit 2f987d7

Please sign in to comment.