From 256c05b086c48ae25f32f7aa5b40677bee68b752 Mon Sep 17 00:00:00 2001 From: Joost van Zwieten Date: Mon, 6 May 2024 15:14:52 +0200 Subject: [PATCH] wip --- tests/test_evaluable.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_evaluable.py b/tests/test_evaluable.py index a6a2d7213..abd52187f 100644 --- a/tests/test_evaluable.py +++ b/tests/test_evaluable.py @@ -376,7 +376,8 @@ def test_derivative(self): approx = numpy.zeros_like(exact) scale = 1 else: - fdvals = numpy.stack([self.actual.eval(**collections.ChainMap({arg_name: numpy.asarray(x0+eps*n*dx)}, evalargs)) for n in (*-fddeltas, *fddeltas)], axis=0) + actual_eval = self.actual.eval + fdvals = numpy.stack([actual_eval(**collections.ChainMap({arg_name: numpy.asarray(x0+eps*n*dx)}, evalargs)) for n in (*-fddeltas, *fddeltas)], axis=0) if fdvals.dtype.kind == 'i': fdvals = fdvals.astype(float) fdvals = fdvals.reshape(2, len(fddeltas), *fdvals.shape[1:]) @@ -814,9 +815,9 @@ class elemwise(TestCase): def assertElemwise(self, items): items = tuple(map(types.arraydata, items)) index = evaluable.Argument('index', (), int) - elemwise = evaluable.Elemwise(items, index, int) + elemwise = evaluable.Elemwise(items, index, int).eval for i, item in enumerate(items): - self.assertEqual(elemwise.eval(index=i).tolist(), numpy.asarray(item).tolist()) + self.assertEqual(elemwise(index=i).tolist(), numpy.asarray(item).tolist()) def test_const_values(self): self.assertElemwise((numpy.arange(2*3*4).reshape(2, 3, 4),)*3)