Skip to content

Commit

Permalink
Add tests for registry item retrieval and expected failures in Python…
Browse files Browse the repository at this point in the history
… registry
  • Loading branch information
loumalouomega committed Dec 17, 2024
1 parent 44ad0a2 commit 7cef84e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion kratos/tests/test_python_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ def testHasItemCpp(self):
# Check that base Process is registered in its corresponding module as well as in the All block
self.assertTrue(KratosMultiphysics.Registry.HasItem("Processes.All.Process"))
self.assertTrue(KratosMultiphysics.Registry.HasItem("Processes.KratosMultiphysics.Process"))
self.assertFalse(KratosMultiphysics.Registry.HasItem("Processes.KratosMultiphysics.ProcessPikachu"))

def testGetItemCpp(self):
# Check that base Process is registered in its corresponding module as well as in the All block
base_process = KratosMultiphysics.Registry["Processes.All.Process.Prototype"]
self.assertTrue(isinstance(base_process, KratosMultiphysics.Process))
base_process = KratosMultiphysics.Registry["Processes.KratosMultiphysics.Process.Prototype"]
self.assertTrue(isinstance(base_process, KratosMultiphysics.Process))

@KratosUnittest.expectedFailure
def testHasItemCppFail(self):
KratosMultiphysics.Registry["Processes.All.ProcessPikachu.Prototype"]

def testHasItemPython(self):
# Add a fake entity to the Python registry
Expand Down Expand Up @@ -39,7 +51,6 @@ def testNumberOfItems(self):
# Remove the auxiliary testing tentities from the Python registry
KratosMultiphysics.Registry.RemoveItem("FakeEntities")


def testAddItem(self):
# Add some fake entities to the Python registry
KratosMultiphysics.Registry.AddItem("Processes.KratosMultiphysics.NewProcess1", KratosMultiphysics.Process())
Expand Down Expand Up @@ -217,4 +228,5 @@ def getA(self):
KratosMultiphysics.Registry.RemoveItem("Processes")

if __name__ == "__main__":
KratosMultiphysics.Logger.GetDefaultOutput().SetSeverity(KratosMultiphysics.Logger.Severity.WARNING)
KratosUnittest.main()

0 comments on commit 7cef84e

Please sign in to comment.