diff --git a/qc_baselib/result.py b/qc_baselib/result.py index c456934..05a257e 100644 --- a/qc_baselib/result.py +++ b/qc_baselib/result.py @@ -280,10 +280,16 @@ def add_xml_location( checker_bundle_name: str, checker_id: str, issue_id: int, - xpath: str, + xpath: Union[str, List[str]], description: str, ) -> None: - xml_location = result.XMLLocationType(xpath=xpath) + xml_locations = [] + + if type(xpath) == str: + xml_locations.append(result.XMLLocationType(xpath=xpath)) + elif type(xpath) == list: + for path in xpath: + xml_locations.append(result.XMLLocationType(xpath=path)) bundle = self._get_checker_bundle(checker_bundle_name=checker_bundle_name) @@ -291,7 +297,7 @@ def add_xml_location( issue = self._get_issue(checker=checker, issue_id=issue_id) issue.locations.append( - result.LocationType(xml_location=[xml_location], description=description) + result.LocationType(xml_location=xml_locations, description=description) ) def add_inertial_location( diff --git a/tests/data/result_test_output.xqar b/tests/data/result_test_output.xqar index c52c23f..7fb51bb 100644 --- a/tests/data/result_test_output.xqar +++ b/tests/data/result_test_output.xqar @@ -10,6 +10,10 @@ + + + + diff --git a/tests/test_result.py b/tests/test_result.py index 32478f6..55c13c8 100644 --- a/tests/test_result.py +++ b/tests/test_result.py @@ -88,6 +88,13 @@ def test_result_write() -> None: xpath="/foo/test/path", description="Location for issue", ) + result.add_xml_location( + checker_bundle_name="TestBundle", + checker_id="TestChecker", + issue_id=issue_id, + xpath=["/foo/test/path", "/bar/test/path"], + description="Location for issue with list", + ) result.add_inertial_location( checker_bundle_name="TestBundle", checker_id="TestChecker",