Skip to content

Commit 6318af3

Browse files
committed
Add proper casting of input arrays passed to assert_almost_equal
1 parent 513b91c commit 6318af3

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

dpnp/tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
from . import testing
44

55
numpy.testing.assert_allclose = testing.assert_allclose
6+
numpy.testing.assert_almost_equal = testing.assert_almost_equal
67
numpy.testing.assert_array_equal = testing.assert_array_equal
78
numpy.testing.assert_equal = testing.assert_equal

dpnp/tests/testing/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from .array import (
22
assert_allclose,
3+
assert_almost_equal,
34
assert_array_equal,
45
assert_equal,
56
)

dpnp/tests/testing/array.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from dpnp.dpnp_utils import convert_item
3030

3131
assert_allclose_orig = numpy.testing.assert_allclose
32+
assert_almost_equal_orig = numpy.testing.assert_almost_equal
3233
assert_array_equal_orig = numpy.testing.assert_array_equal
3334
assert_equal_orig = numpy.testing.assert_equal
3435

@@ -44,6 +45,10 @@ def assert_allclose(result, expected, *args, **kwargs):
4445
_assert(assert_allclose_orig, result, expected, *args, **kwargs)
4546

4647

48+
def assert_almost_equal(result, expected, *args, **kwargs):
49+
_assert(assert_almost_equal_orig, result, expected, *args, **kwargs)
50+
51+
4752
def assert_array_equal(result, expected, *args, **kwargs):
4853
_assert(assert_array_equal_orig, result, expected, *args, **kwargs)
4954

0 commit comments

Comments
 (0)