Skip to content
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

Add get attribute type function in utils #26

Merged
merged 2 commits into from
Jul 11, 2024

Conversation

romanodanilo
Copy link
Contributor

@romanodanilo romanodanilo commented Jul 11, 2024

Description

While testing with the xosc examples, it was found a case in which an OpenSCENARIO expression was considered a parameter, and for that an issue was incorrectly raised:

        Error:      #0: Issue flagging when used parameters is not defined or has not default value within a catalog
                    Parameter value {250/3.6} for attribute maxSpeed is not defined in Catalog or has no default value
                       XPath: /OpenSCENARIO/Catalog/Vehicle[3]/Performance

This is now fixed with a classification function that tells whether a string is an expression, a parameter or just a plain string

How was the PR tested?

  1. Unit-test with sample data. All unit tests passed.

Notes

utils test function:

>>> utils.get_attribute_type("TEST")
<AttributeType.VALUE: 0>
>>> utils.get_attribute_type("$TEST")
<AttributeType.PARAMETER: 2>
>>> utils.get_attribute_type("${TEST")
<AttributeType.VALUE: 0>
>>> utils.get_attribute_type("${1/3}")
<AttributeType.EXPRESSION: 1>

Signed-off-by: romanodanilo <[email protected]>
Copy link
Contributor

@hoangtungdinh hoangtungdinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @romanodanilo

@hoangtungdinh hoangtungdinh merged commit 4a936c5 into develop Jul 11, 2024
7 checks passed
@hoangtungdinh hoangtungdinh deleted the danilo/fix_parameter_check branch July 11, 2024 11:28
hoangtungdinh pushed a commit that referenced this pull request Jul 11, 2024
Signed-off-by: romanodanilo <[email protected]>

Signed-off-by: romanodanilo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants