Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvanzwieten committed May 23, 2024
1 parent 529b69f commit 0d631b9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_evaluable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:])
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0d631b9

Please sign in to comment.