From 7cef84e939541a5f1d6a05c21c44cb41ffd8e88f Mon Sep 17 00:00:00 2001 From: Vicente Mataix Ferrandiz Date: Tue, 17 Dec 2024 10:57:18 +0100 Subject: [PATCH] Add tests for registry item retrieval and expected failures in Python registry --- kratos/tests/test_python_registry.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kratos/tests/test_python_registry.py b/kratos/tests/test_python_registry.py index b47e2d543b51..a806084d6370 100644 --- a/kratos/tests/test_python_registry.py +++ b/kratos/tests/test_python_registry.py @@ -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 @@ -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()) @@ -217,4 +228,5 @@ def getA(self): KratosMultiphysics.Registry.RemoveItem("Processes") if __name__ == "__main__": + KratosMultiphysics.Logger.GetDefaultOutput().SetSeverity(KratosMultiphysics.Logger.Severity.WARNING) KratosUnittest.main()