forked from rwth-iat/basyx-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
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
improve AssetInformation
and Entity
constraint validation + add tests
#1
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The default inherited `clear()` implementation repeatedly deletes the last item of the list until the list is empty. If the last item can be deleted successfully, but an item in front of it that will be deleted later cannot, this makes `clear()` non-atomic. Thus, the `clear()` method is now overriden in an atomic way. Furthermore, the ConstrainedList atomicity test is fixed to correctly test for this as well.
This decorator silently overrides the `global_asset_id` property, resulting in the constraints not being checked properly.
… to setter This only needs to be checked if the `global_asset_id` changes.
`_validate_asset_ids_for_entity_type()` only needs to know whether there are `specific_asset_ids` or not. This can be represented by a boolean, allowing the delete hook of the `ConstrainedList` to make use of this function as well.
Similar to `submodel.Entity`, this is done to reduce duplicate code.
…ecific_asset_id` Since `__setitem__` can be used to clear the list as well (e.g. `list[:] = ()`), the constraints need to be verified in this case as well.
The attributes need to be assigned bypassing the setters because the setters try to access attributes that haven't been set yet for constraint validation. Only `global_asset_id` is set via the setter as a final constraint validation, and because `global_asset_id` is also constrained via a string constraint.
…ty}.specific_asset_id` This prevents setting the attributes without verification of the constraints.
…to `Entity` This adds an `item_add_hook` to the `specific_asset_id` `ConstrainedList`, which is called whenever a new item is added to the list. This is necessary because a co-managed `Entity` is not allowed to have specific asset ids, so it shouldn't be possible to add any in this case.
…et_id` type hints
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the validation of AASd-014 for
Entity
and AASd-131 forAssetInformation
. Furthermore, tests are added. Please refer to the individual commit messages as for why something was changed.This PR also includes the commits from eclipse-basyx#153 for the tests to succeed and thus depends on it.