Skip to content
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
12 changes: 12 additions & 0 deletions src/ansys/dynamicreporting/core/utils/report_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,18 @@ def set_html(self, value=""):
else:
raise ValueError(f"Error: HTML not supported on the report type {self.report_type}")

def set_comments(self, value=""):
if "Layout:" in self.report_type:
if isinstance(value, str):
d = json.loads(self.params)
d["comments"] = value
self.params = json.dumps(d)
return
else:
raise ValueError("Error: input needs to be a string")
else:
raise ValueError(f"Error: Comments not supported on the report type {self.report_type}")

def get_transpose(self):
if "Layout:" in self.report_type:
if "transpose" in json.loads(self.params):
Expand Down
11 changes: 11 additions & 0 deletions tests/test_report_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,17 @@ def test_layout_html() -> bool:
assert success


def test_set_comments() -> None:
a = ro.LayoutREST()
a.set_comments(value="lololol")
success = False
try:
a.set_comments(value=4)
except ValueError as e:
success = "input needs to be a string" in str(e)
assert success


def test_layout_transport() -> bool:
a = ro.LayoutREST()
zero = a.get_transpose()
Expand Down