-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'eclipse-basyx/main' into refactor/http_api
# Conflicts: # basyx/aas/adapter/http.py
- Loading branch information
Showing
3 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (c) 2024 the Eclipse BaSyx Authors | ||
# | ||
# This program and the accompanying materials are made available under the terms of the MIT License, available in | ||
# the LICENSE file of this project. | ||
# | ||
# SPDX-License-Identifier: MIT | ||
import unittest | ||
|
||
from basyx.aas import model | ||
from basyx.aas.examples.data import create_example, create_example_aas_binding | ||
|
||
|
||
class TestExampleFunctions(unittest.TestCase): | ||
|
||
def test_create_example(self): | ||
obj_store = create_example() | ||
|
||
# Check that the object store is not empty | ||
self.assertGreater(len(obj_store), 0) | ||
|
||
# Check that the object store contains expected elements | ||
expected_ids = [ | ||
'https://acplt.org/Test_AssetAdministrationShell', | ||
'https://acplt.org/Test_Submodel_Template', | ||
'https://acplt.org/Test_ConceptDescription_Mandatory' | ||
] | ||
for id in expected_ids: | ||
self.assertIsNotNone(obj_store.get_identifiable(id)) | ||
|
||
def test_create_example_aas_binding(self): | ||
obj_store = create_example_aas_binding() | ||
|
||
# Check that the object store is not empty | ||
self.assertGreater(len(obj_store), 0) | ||
|
||
# Check that the object store contains expected elements | ||
aas_id = 'https://acplt.org/Test_AssetAdministrationShell' | ||
sm_id = 'https://acplt.org/Test_Submodel_Template' | ||
cd_id = 'https://acplt.org/Test_ConceptDescription_Mandatory' | ||
|
||
aas = obj_store.get_identifiable(aas_id) | ||
sm = obj_store.get_identifiable(sm_id) | ||
cd = obj_store.get_identifiable(cd_id) | ||
|
||
self.assertIsNotNone(aas) | ||
self.assertIsNotNone(sm) | ||
self.assertIsNotNone(cd) | ||
|
||
# Check types | ||
self.assertIsInstance(aas, model.aas.AssetAdministrationShell) | ||
self.assertIsInstance(sm, model.submodel.Submodel) | ||
self.assertIsInstance(cd, model.concept.ConceptDescription) | ||
|
||
# Check that the submodel is referred by the AAS | ||
self.assertIn(model.ModelReference.from_referable(sm), aas.submodel) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) 2023 the Eclipse BaSyx Authors | ||
# | ||
# This program and the accompanying materials are made available under the terms of the MIT License, available in | ||
# the LICENSE file of this project. | ||
# | ||
# SPDX-License-Identifier: MIT | ||
import unittest | ||
|
||
from basyx.aas.examples.data import example_aas | ||
from basyx.aas import model | ||
|
||
|
||
class ConceptDescriptionTest(unittest.TestCase): | ||
def test_concept_description(self): | ||
concept_description = example_aas.create_example_concept_description() | ||
|
||
concept_description._set_category(category=None) | ||
concept_description_category = concept_description.__dict__.get("_category") | ||
self.assertEqual(concept_description_category, "PROPERTY") | ||
|
||
concept_description._set_category(category="VALUE") | ||
concept_description_category = concept_description.__dict__.get("_category") | ||
self.assertEqual(concept_description_category, "VALUE") | ||
|
||
with self.assertRaises(model.base.AASConstraintViolation): | ||
concept_description._set_category(category="FORBIDDEN_CONCEPT_DESCRIPTION") |