Skip to content

Commit

Permalink
test.backend: Remove outdated tests, fix codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
s-heppner committed Jan 20, 2025
1 parent 791e754 commit 4c5217d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 33 deletions.
2 changes: 1 addition & 1 deletion sdk/basyx/aas/examples/tutorial_backend_couchdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@

# Let's delete the Submodels from the CouchDB to leave it in a clean state
object_store.discard(example_submodel1)
object_store.discard(example_submodel2)
object_store.discard(example_submodel2)
2 changes: 1 addition & 1 deletion sdk/basyx/aas/model/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AbstractObjectStore(AbstractObjectProvider, MutableSet[_IT], Generic[_IT],
:class:`~basyx.aas.model.base.Identifier` – allow to add and delete objects (i.e. behave like a Python set).
This includes local object stores (like :class:`~.DictObjectStore`) and specific object stores
(like :class:`~basyx.aas.backend.couchdb.CouchDBObjectStore` and
:class `~basyx.aas.backend.local_file.LocalFileObjectStore).
:class `~basyx.aas.backend.local_file.LocalFileObjectStore`).
The AbstractObjectStore inherits from the :class:`~collections.abc.MutableSet` abstract collections class and
therefore implements all the functions of this class.
Expand Down
24 changes: 5 additions & 19 deletions sdk/test/backend/test_couchdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def setUp(self) -> None:
def tearDown(self) -> None:
self.object_store.clear()

# def test_object_store_add(self):
# test_object = create_example_submodel()
# self.object_store.add(test_object)
# # TODO: Adapt the test
# self.assertEqual(test_object.source, source_core+"https%3A%2F%2Facplt.org%2FTest_Submodel")
def test_object_store_add(self):
test_object = create_example_submodel()
self.object_store.add(test_object)
# Note that this test is only checking that there are no errors during adding.
# The actual logic is tested together with retrieval in `test_retrieval`.

def test_retrieval(self):
test_object = create_example_submodel()
Expand Down Expand Up @@ -108,17 +108,3 @@ def test_key_errors(self) -> None:
self.object_store.discard(retrieved_submodel)
self.assertEqual("'No AAS object with id https://acplt.org/Test_Submodel exists in "
"CouchDB database'", str(cm.exception))

def test_conflict_errors(self):
# Preperation: add object and retrieve it from the database
example_submodel = create_example_submodel()
self.object_store.add(example_submodel)
retrieved_submodel = self.object_store.get_identifiable('https://acplt.org/Test_Submodel')

# Deleting the submodel with safe_delete should or without safe_delete should work
self.object_store.discard(retrieved_submodel, True)
self.assertEqual(0, len(self.object_store))

def test_editing(self):
test_object = create_example_submodel()
self.object_store.add(test_object)
17 changes: 5 additions & 12 deletions sdk/test/backend/test_local_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ def tearDown(self) -> None:
finally:
shutil.rmtree(store_path)

# def test_object_store_add(self):
# test_object = create_example_submodel()
# self.object_store.add(test_object)
# # TODO: Adapt this test
# self.assertEqual(
# test_object.source,
# source_core+"fd787262b2743360f7ad03a3b4e9187e4c088aa37303448c9c43fe4c973dac53.json"
# )
def test_object_store_add(self):
test_object = create_example_submodel()
self.object_store.add(test_object)
# Note that this test is only checking that there are no errors during adding.
# The actual logic is tested together with retrieval in `test_retrieval`.

def test_retrieval(self):
test_object = create_example_submodel()
Expand Down Expand Up @@ -107,7 +104,3 @@ def test_key_errors(self) -> None:
self.object_store.discard(retrieved_submodel)
self.assertEqual("'No AAS object with id https://acplt.org/Test_Submodel exists in "
"local file database'", str(cm.exception))

def test_editing(self):
test_object = create_example_submodel()
self.object_store.add(test_object)

0 comments on commit 4c5217d

Please sign in to comment.