Describe the bug
In the file qc_openscenario/checks/reference_checker/resolvable_signal_id_in_traffic_signal_state_action.py Line 55
xodr_signal_list = checker_data.xodr_root.findall(".//signal")
if xodr_signal_list is None:
....
was used.
The problem is that the xml package will give back an empty list if no values are found, and not None.
This makes the if statement always false.
To Reproduce
Steps to reproduce the behavior:
- install the packages
pip install asam-qc-baselib
pip install asam-qc-openscenarioxml
2.) Save this script and fill out the file_path
from qc_baselib import Configuration, Result
from qc_openscenario.checks.models import CheckerData
from qc_openscenario.checks import reference_checker
from qc_openscenario.checks import utils
from qc_openscenario import constants
def main():
file_path = "path/to/openSCENARIO.xosc"
config = Configuration()
result = Result()
checker_data = CheckerData(
xml_file_path=file_path,
input_file_xml_root=None,
config=config,
result=result,
schema_version="1.0.0",
xodr_root=None
)
result.register_checker_bundle(
name=constants.BUNDLE_NAME,
description="OpenScenario checker bundle",
version=constants.BUNDLE_VERSION,
summary="",
)
result.set_result_version(version=constants.BUNDLE_VERSION)
checker = reference_checker.resolvable_signal_id_in_traffic_signal_state_action
result.register_checker(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=checker.CHECKER_ID,
description=checker.CHECKER_DESCRIPTION,
)
# Register the associated rule using the rule UID
result.register_rule_by_uid(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=checker.CHECKER_ID,
rule_uid=checker.RULE_UID,
)
checker_data.input_file_xml_root = utils.get_root_without_default_namespace(checker_data.xml_file_path)
checker_data.xodr_root = checker_data.input_file_xml_root
checker.check_rule(checker_data = checker_data)
if __name__ == "__main__":
main()
Go to debug mode (or add a print) and check the value xodr_signal_list in
qc_openscenario/checks/reference_checker/resolvable_signal_id_in_traffic_signal_state_action.py
- Expected behavior
The code should go in the
if xodr_signal_list is None:
statement if no signals are present in the openDRIVE file.
Screenshots
Desktop (please complete the following information):
Additional context
The bug exist in multiple instances in the package.
Describe the bug
In the file qc_openscenario/checks/reference_checker/resolvable_signal_id_in_traffic_signal_state_action.py Line 55
was used.
The problem is that the xml package will give back an empty list if no values are found, and not None.
This makes the if statement always false.
To Reproduce
Steps to reproduce the behavior:
2.) Save this script and fill out the file_path
Go to debug mode (or add a print) and check the value xodr_signal_list in
qc_openscenario/checks/reference_checker/resolvable_signal_id_in_traffic_signal_state_action.py
The code should go in the
statement if no signals are present in the openDRIVE file.
Screenshots
Desktop (please complete the following information):
Additional context
The bug exist in multiple instances in the package.