Skip to content

Commit

Permalink
feat: enhance get_description to include methods
Browse files Browse the repository at this point in the history
Extend the `get_description` function to retrieve methods information,
providing a unified approach for accessing this data.
  • Loading branch information
clnsmth authored Nov 5, 2024
1 parent 42dbf77 commit adad111
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/spinneret/workbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def get_description(element: etree._Element) -> str:
description = element.findtext(".//entityName")
elif element.tag in "attribute":
description = element.findtext(".//attributeDefinition")
elif element.tag in "methods":
methods = etree.tostring(element, encoding="utf-8", method="text")
description = methods.decode("utf-8").strip()
else:
description = None
return description
Expand Down
2 changes: 1 addition & 1 deletion tests/test_workbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_get_description():
eml = load_eml(eml_file)

# Elements to test (note dataTable is a general test for data entities)
elements = ["dataset", "dataTable", "attribute"]
elements = ["dataset", "dataTable", "attribute", "methods"]

# Test each element
for element in elements:
Expand Down

0 comments on commit adad111

Please sign in to comment.