Skip to content

Commit

Permalink
Merge pull request numpy#22179 from MatteoRaso/randint_test
Browse files Browse the repository at this point in the history
TST: Implemented an unused test for np.random.randint
  • Loading branch information
charris authored Aug 31, 2022
2 parents 8b9b349 + 1647f46 commit 917335c
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions numpy/random/tests/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -1712,23 +1712,22 @@ def test_two_arg_funcs(self):
out = func(self.argOne, argTwo[0])
assert_equal(out.shape, self.tgtShape)

# TODO: Uncomment once randint can broadcast arguments
# def test_randint(self):
# itype = [bool, np.int8, np.uint8, np.int16, np.uint16,
# np.int32, np.uint32, np.int64, np.uint64]
# func = np.random.randint
# high = np.array([1])
# low = np.array([0])
#
# for dt in itype:
# out = func(low, high, dtype=dt)
# self.assert_equal(out.shape, self.tgtShape)
#
# out = func(low[0], high, dtype=dt)
# self.assert_equal(out.shape, self.tgtShape)
#
# out = func(low, high[0], dtype=dt)
# self.assert_equal(out.shape, self.tgtShape)
def test_randint(self):
itype = [bool, np.int8, np.uint8, np.int16, np.uint16,
np.int32, np.uint32, np.int64, np.uint64]
func = np.random.randint
high = np.array([1])
low = np.array([0])

for dt in itype:
out = func(low, high, dtype=dt)
assert_equal(out.shape, self.tgtShape)

out = func(low[0], high, dtype=dt)
assert_equal(out.shape, self.tgtShape)

out = func(low, high[0], dtype=dt)
assert_equal(out.shape, self.tgtShape)

def test_three_arg_funcs(self):
funcs = [np.random.noncentral_f, np.random.triangular,
Expand Down

0 comments on commit 917335c

Please sign in to comment.