Skip to content

Commit

Permalink
[test] removed the assertNear() function from utiliites.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wandadars committed Oct 2, 2024
1 parent ed2206a commit 4a3ba02
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions test/python/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@

# Custom assertions functions

def assertNear(a, b, rtol=1e-8, atol=1e-12, msg=None):
if a == b:
return # handles case where a == b == inf
cmp = 2 * abs(a - b)/(abs(a) + abs(b) + 2 * atol / rtol)
if not cmp < rtol:
message = ('AssertNear: %.14g - %.14g = %.14g\n' % (a, b, a-b) +
'Relative error of %10e exceeds rtol = %10e' % (cmp, rtol))
if msg:
message = msg + '\n' + message
pytest.fail(message)

def assertArrayNear(A, B, rtol=1e-8, atol=1e-12, msg=None):
if len(A) != len(B):
pytest.fail("Arrays are of different lengths ({0}, {1})".format(len(A), len(B)))
Expand Down

0 comments on commit 4a3ba02

Please sign in to comment.