From ff35c4e41dd56408fb5d32abb98d45badc02f8eb Mon Sep 17 00:00:00 2001 From: Simon Suchan Date: Thu, 4 Jul 2024 16:03:21 +0200 Subject: [PATCH] test.model.test_concept.py: Added seperate test file for model.concept.py including a test for ConceptDescription._set_category --- test/model/test_concept.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/model/test_concept.py diff --git a/test/model/test_concept.py b/test/model/test_concept.py new file mode 100644 index 000000000..c8bfefce9 --- /dev/null +++ b/test/model/test_concept.py @@ -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")