Skip to content

Commit 310914c

Browse files
committed
Improve test coverage in dpnp.histogram
1 parent 8389846 commit 310914c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

dpnp/tests/helper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from numpy.testing import assert_allclose, assert_array_equal
77

88
import dpnp
9-
from dpnp.tests import config
9+
10+
from . import config
1011

1112

1213
def assert_dtype_allclose(
@@ -86,14 +87,14 @@ def assert_dtype_allclose(
8687
assert dpnp_arr.dtype == numpy_arr.dtype
8788

8889

89-
def get_integer_dtypes(no_unsigned=False):
90+
def get_integer_dtypes(all_int_types=False, no_unsigned=False):
9091
"""
9192
Build a list of integer types supported by DPNP.
9293
"""
9394

9495
dtypes = [dpnp.int32, dpnp.int64]
9596

96-
if config.all_int_types:
97+
if config.all_int_types or all_int_types:
9798
dtypes += [dpnp.int8, dpnp.int16]
9899
if not no_unsigned:
99100
dtypes += [dpnp.uint8, dpnp.uint16, dpnp.uint32, dpnp.uint64]

dpnp/tests/test_histogram.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,10 @@ def test_weights(self, density):
282282
assert_dtype_allclose(result_hist, expected_hist)
283283
assert_dtype_allclose(result_edges, expected_edges)
284284

285-
def test_integer_weights(self):
285+
@pytest.mark.parametrize("dt", get_integer_dtypes(all_int_types=True))
286+
def test_integer_weights(self, dt):
286287
v = numpy.array([1, 2, 2, 4])
287-
w = numpy.array([4, 3, 2, 1])
288+
w = numpy.array([4, 3, 2, 1], dtype=dt)
288289

289290
iv = dpnp.array(v)
290291
iw = dpnp.array(w)

0 commit comments

Comments
 (0)