From 259751abde6c2489cdf381b4583e6e92c1a9991b Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Tue, 14 Jan 2025 20:43:08 +0100 Subject: [PATCH 1/2] fix: parsing components when too many --- src/ansys/mapdl/core/component.py | 4 ++-- tests/test_component.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ansys/mapdl/core/component.py b/src/ansys/mapdl/core/component.py index 402f229338..ad03341d6b 100644 --- a/src/ansys/mapdl/core/component.py +++ b/src/ansys/mapdl/core/component.py @@ -580,13 +580,13 @@ def _parse_cmlist(cmlist: Optional[str] = None) -> Dict[str, Any]: # header # "NAME TYPE SUBCOMPONENTS" blocks = re.findall( - r"(?s)NAME\s+TYPE\s+SUBCOMPONENTS\s+(.*?)\s*(?=\n\s*\n|\Z)", + r"(?s)NAME\s+TYPE\s+SUBCOMPONENTS\s+(.*?)\s*(?=\n\s*\n|\*\*\*\*\*|\Z)", cmlist, flags=re.DOTALL, ) elif re.search(r"NAME\s+SELE\s+TYPE\s+SUBCOMPONENTS", cmlist): blocks = re.findall( - r"(?s)NAME\s+SELE\s+TYPE\s+SUBCOMPONENTS\s+(.*?)\s*(?=\n\s*\n|\Z)", + r"(?s)NAME\s+SELE\s+TYPE\s+SUBCOMPONENTS\s+(.*?)\s*(?=\n\s*\n|\*\*\*\*\*|\Z)", cmlist, flags=re.DOTALL, ) diff --git a/tests/test_component.py b/tests/test_component.py index aa790c4ff7..78ec707e78 100644 --- a/tests/test_component.py +++ b/tests/test_component.py @@ -327,3 +327,21 @@ def test__get_all_components_type(mapdl, cube_geom_and_mesh): assert comp_nodes == expected_output assert "CMELEM" not in comp_nodes assert "CMELEM2" not in comp_nodes + + +def test_parsing_too_many_components(mapdl, cleared): + mapdl.prep7() + + for i in range(1, 100): + mapdl.nsel("NONE") + mapdl.n(i, i, 0, 0) + mapdl.cm(f"node_{i:03.0f}", "NODE") + + s = mapdl.components.__str__() + assert len(mapdl.components._comp) == 99 + + assert "VERIFICATION" not in s + assert "***" not in s + assert "*****MAPDL" not in s + for i in range(1, 100): + assert re.search(f"NODE_{i:03.0f}\s+: NODE", s) From 74c6c675698bc98b5cba44442b4f7b795f0bca59 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:46:31 +0000 Subject: [PATCH 2/2] chore: adding changelog file 3662.fixed.md [dependabot-skip] --- doc/changelog.d/3662.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/3662.fixed.md diff --git a/doc/changelog.d/3662.fixed.md b/doc/changelog.d/3662.fixed.md new file mode 100644 index 0000000000..4e7029bdb5 --- /dev/null +++ b/doc/changelog.d/3662.fixed.md @@ -0,0 +1 @@ +fix: parsing components when too many \ No newline at end of file