From 4c12c2180d7e5147b5de2f7128207ec0f673663b Mon Sep 17 00:00:00 2001 From: "Adam M. Krajewski" <54290107+amkrajewski@users.noreply.github.com> Date: Wed, 3 Apr 2024 19:44:20 -0400 Subject: [PATCH] (tests) added testing procedure for endpoint overriding --- pysipfenn/tests/test_ModelAdjusters.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/pysipfenn/tests/test_ModelAdjusters.py b/pysipfenn/tests/test_ModelAdjusters.py index d73585c..3d7f4ed 100644 --- a/pysipfenn/tests/test_ModelAdjusters.py +++ b/pysipfenn/tests/test_ModelAdjusters.py @@ -168,5 +168,27 @@ def testDataLoading(self): descriptor="SomeCrazyDescriptor", ) - - + def testEndpointOverride(self): + """ + Test the endpoint override functionality of the ``OPTIMADEAdjuster`` class. It will test the override of the + endpoint and the data fetching from the new endpoint. + """ + endpoint = ["https://alexandria.icams.rub.de/pbesol"] + targetPath = ['attributes', '_alexandria_formation_energy_per_atom'] + + self.ma2 = pysipfenn.OPTIMADEAdjuster( + self.c, + model="SIPFENN_Krajewski2022_NN30", + endpointOverride=endpoint, + targetPath=targetPath) + + self.ma2.fetchAndFeturize( + 'elements HAS "Hf" AND elements HAS "Mo" AND elements HAS "Zr"', + parallelWorkers=2) + + self.assertGreaterEqual(len(self.ma2.comps), 0, "No compositions were found, thus no data was fetched.") + self.assertGreaterEqual(len(self.ma2.names), 0, "No names were found, thus no data was fetched.") + self.assertGreaterEqual( + len(self.ma2.descriptorData), 0, + "No descriptor data was found. If the other asserts passed, this is likely a bug in the featurization " + "or structural data has been made incompatible or otherwise corrupted.") \ No newline at end of file