Skip to content

Return all the subtitles even if they are empty. #2017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ansys/mapdl/core/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ def load_step_options(self):

def _get_between(self, init_string, end_string=None, string=None):
if not string:
self._update()
string = self._stats

st = string.find(init_string) + len(init_string)
Expand Down Expand Up @@ -959,8 +960,9 @@ def _get_title(self):
def _get_stitles(self):
return [
re.search(f"SUBTITLE {i}=(.*)", self._get_titles()).groups(1)[0].strip()
for i in range(1, 5)
if re.search(f"SUBTITLE {i}=(.*)", self._get_titles())
else ""
for i in range(1, 5)
]

def _get_products(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_info_title(mapdl):
def test_info_stitle(mapdl):
info = mapdl.info

assert not info.stitles
assert all([not each for each in info.stitles])
stitles = ["asfd", "qwer", "zxcv", "jkl"]
info.stitles = "\n".join(stitles)

Expand All @@ -162,7 +162,7 @@ def test_info_stitle(mapdl):
assert stitles == info.stitles

info.stitles = None
assert not info.stitles
assert all([not each for each in info.stitles])


@pytest.mark.parametrize("file_", ["dummy.dumdum", "dumdum.dummy"])
Expand Down