Skip to content

Commit

Permalink
fixing numerical round off errors in test
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGilardoni committed Nov 28, 2024
1 parent f88e139 commit c10b5e1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_loss_and_minimizer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest
import MDRefine
from MDRefine import compute_new_weights, compute_chi2, compute_D_KL, l2_regularization
import scipy

class my_testcase(unittest.TestCase):
def assertEqualObjs(self, obj1, obj2):
Expand Down Expand Up @@ -46,9 +47,10 @@ def assertEqualObjs(self, obj1, obj2):
if isinstance(obj1, bytes) or isinstance(obj2, bytes):
if isinstance(obj1, bytes): obj1 = str(obj1, 'utf-8')
else: obj2 = str(obj2, 'utf-8')
else: print('WARNING: obj1 is ', type(obj1), 'while obj2 is ', type(obj2))

self.assertEqual(obj1, obj2)
elif not (isinstance(obj1, scipy.optimize._lbfgsb_py.LbfgsInvHessProduct) or isinstance(obj1, scipy.optimize._lbfgsb_py.LbfgsInvHessProduct)):
print('WARNING: obj1 is ', type(obj1), 'while obj2 is ', type(obj2))

self.assertEqual(obj1, obj2)

class Test(my_testcase):

Expand Down

0 comments on commit c10b5e1

Please sign in to comment.