Skip to content

Commit 836083e

Browse files
Resolved deprecation notices in test suite
1 parent faab53a commit 836083e

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

mkl_random/tests/test_random.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_size(self):
126126
(2, 2, 2))
127127

128128
assert_raises(TypeError, rnd.multinomial, 1, p,
129-
np.float(1))
129+
np.float64(1))
130130

131131

132132
class TestSetState_Intel(TestCase):
@@ -185,7 +185,7 @@ class TestRandint_Intel(TestCase):
185185
np.int32, np.uint32, np.int64, np.uint64]
186186

187187
def test_unsupported_type(self):
188-
assert_raises(TypeError, self.rfunc, 1, dtype=np.float)
188+
assert_raises(TypeError, self.rfunc, 1, dtype=np.float64)
189189

190190
def test_bounds_checking(self):
191191
for dt in self.itype:
@@ -215,7 +215,7 @@ def test_in_bounds_fuzz(self):
215215
vals = self.rfunc(2, ubnd, size=2**16, dtype=dt)
216216
assert_(vals.max() < ubnd)
217217
assert_(vals.min() >= 2)
218-
vals = self.rfunc(0, 2, size=2**16, dtype=np.bool)
218+
vals = self.rfunc(0, 2, size=2**16, dtype='bool')
219219
assert_(vals.max() < 2)
220220
assert_(vals.min() >= 0)
221221

@@ -244,14 +244,13 @@ def test_repeatability(self):
244244
val = self.rfunc(0, 6, size=1000, dtype=dt).byteswap()
245245

246246
res = hashlib.md5(val.view(np.int8)).hexdigest()
247-
print("")
248247
assert_(tgt[np.dtype(dt).name] == res)
249248

250249
# bools do not depend on endianess
251250
rnd.seed(1234, brng='MT19937')
252-
val = self.rfunc(0, 2, size=1000, dtype=np.bool).view(np.int8)
251+
val = self.rfunc(0, 2, size=1000, dtype='bool').view(np.int8)
253252
res = hashlib.md5(val).hexdigest()
254-
assert_(tgt[np.dtype(np.bool).name] == res)
253+
assert_(tgt[np.dtype('bool').name] == res)
255254

256255
def test_respect_dtype_singleton(self):
257256
# See gh-7203
@@ -262,9 +261,9 @@ def test_respect_dtype_singleton(self):
262261
sample = self.rfunc(lbnd, ubnd, dtype=dt)
263262
self.assertEqual(sample.dtype, np.dtype(dt))
264263

265-
for dt in (np.bool, np.int, np.long):
266-
lbnd = 0 if dt is np.bool else np.iinfo(dt).min
267-
ubnd = 2 if dt is np.bool else np.iinfo(dt).max + 1
264+
for dt in (bool, int):
265+
lbnd = 0 if dt is bool else np.iinfo(np.dtype(dt)).min
266+
ubnd = 2 if dt is bool else np.iinfo(np.dtype(dt)).max + 1
268267

269268
# gh-7284: Ensure that we get Python data types
270269
sample = self.rfunc(lbnd, ubnd, dtype=dt)
@@ -527,7 +526,7 @@ def test_dirichlet_size(self):
527526
assert_equal(rnd.dirichlet(p, (2, 2)).shape, (2, 2, 2))
528527
assert_equal(rnd.dirichlet(p, np.array((2, 2))).shape, (2, 2, 2))
529528

530-
assert_raises(TypeError, rnd.dirichlet, p, np.float(1))
529+
assert_raises(TypeError, rnd.dirichlet, p, np.float64(1))
531530

532531

533532
def test_exponential(self):

0 commit comments

Comments
 (0)