From d554b4dfb6ea96aea44628be008cc52096de04fc Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 2 Feb 2023 11:41:47 +0100 Subject: [PATCH] Support high=None in dpnp.randint() --- dpnp/random/dpnp_random_state.py | 4 ++-- tests/third_party/cupy/random_tests/test_sample.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dpnp/random/dpnp_random_state.py b/dpnp/random/dpnp_random_state.py index 1d4648c31c47..f81a371edebe 100644 --- a/dpnp/random/dpnp_random_state.py +++ b/dpnp/random/dpnp_random_state.py @@ -1,7 +1,7 @@ # cython: language_level=3 # -*- coding: utf-8 -*- # ***************************************************************************** -# Copyright (c) 2016-2022, Intel Corporation +# Copyright (c) 2016-2023, Intel Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -332,7 +332,7 @@ def randint(self, low, high=None, size=None, dtype=int, usm_type="device"): if not use_origin_backend(low): if not dpnp.isscalar(low): pass - elif not dpnp.isscalar(high): + elif not (high is None or dpnp.isscalar(high)): pass else: _dtype = dpnp.int32 if dtype is int else dpnp.dtype(dtype) diff --git a/tests/third_party/cupy/random_tests/test_sample.py b/tests/third_party/cupy/random_tests/test_sample.py index 3f8a0169ac12..f3b844cdc6a5 100644 --- a/tests/third_party/cupy/random_tests/test_sample.py +++ b/tests/third_party/cupy/random_tests/test_sample.py @@ -33,7 +33,6 @@ def test_lo_hi_nonrandom(self): a = random.randint(-1.1, -0.9, size=(2, 2)) numpy.testing.assert_array_equal(a, cupy.full((2, 2), -1)) - @pytest.mark.usefixtures("allow_fall_back_on_numpy") def test_zero_sizes(self): a = random.randint(10, size=(0,)) numpy.testing.assert_array_equal(a, cupy.array(())) @@ -112,7 +111,6 @@ def test_goodness_of_fit_2(self): self.assertTrue(hypothesis.chi_square_test(counts, expected)) -@pytest.mark.usefixtures("allow_fall_back_on_numpy") @testing.gpu class TestRandintDtype(unittest.TestCase):