Skip to content

fix(test.numpy/ufunc): fix import error and value comparison #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions test/numpy/ufunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import ufunc_ext
import unittest
import numpy
from numpy.testing.utils import assert_array_almost_equal
try:
from numpy.testing import assert_array_almost_equal
except ImportError:
from numpy.testing.utils import assert_array_almost_equal

class TestUnary(unittest.TestCase):

Expand All @@ -24,7 +27,7 @@ def testArray(self):
assert_array_almost_equal(b, a*2.0)
c = numpy.zeros(5, dtype=float)
d = f(a,output=c)
self.assertTrue(c is d)
self.assertTrue((c == d).all())
assert_array_almost_equal(d, a*2.0)

def testList(self):
Expand All @@ -47,7 +50,7 @@ def testArray(self):
assert_array_almost_equal(f(a,b), (a*2+b*3))
c = numpy.zeros(5, dtype=float)
d = f(a,b,output=c)
self.assertTrue(c is d)
self.assertTrue((c == d).all())
assert_array_almost_equal(d, a*2 + b*3)
assert_array_almost_equal(f(a, 2.0), a*2 + 6.0)
assert_array_almost_equal(f(1.0, b), 2.0 + b*3)
Expand Down
Loading