@@ -126,7 +126,7 @@ def test_size(self):
126
126
(2 , 2 , 2 ))
127
127
128
128
assert_raises (TypeError , rnd .multinomial , 1 , p ,
129
- np .float (1 ))
129
+ np .float64 (1 ))
130
130
131
131
132
132
class TestSetState_Intel (TestCase ):
@@ -185,7 +185,7 @@ class TestRandint_Intel(TestCase):
185
185
np .int32 , np .uint32 , np .int64 , np .uint64 ]
186
186
187
187
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 )
189
189
190
190
def test_bounds_checking (self ):
191
191
for dt in self .itype :
@@ -215,7 +215,7 @@ def test_in_bounds_fuzz(self):
215
215
vals = self .rfunc (2 , ubnd , size = 2 ** 16 , dtype = dt )
216
216
assert_ (vals .max () < ubnd )
217
217
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' )
219
219
assert_ (vals .max () < 2 )
220
220
assert_ (vals .min () >= 0 )
221
221
@@ -244,14 +244,13 @@ def test_repeatability(self):
244
244
val = self .rfunc (0 , 6 , size = 1000 , dtype = dt ).byteswap ()
245
245
246
246
res = hashlib .md5 (val .view (np .int8 )).hexdigest ()
247
- print ("" )
248
247
assert_ (tgt [np .dtype (dt ).name ] == res )
249
248
250
249
# bools do not depend on endianess
251
250
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 )
253
252
res = hashlib .md5 (val ).hexdigest ()
254
- assert_ (tgt [np .dtype (np . bool ).name ] == res )
253
+ assert_ (tgt [np .dtype (' bool' ).name ] == res )
255
254
256
255
def test_respect_dtype_singleton (self ):
257
256
# See gh-7203
@@ -262,9 +261,9 @@ def test_respect_dtype_singleton(self):
262
261
sample = self .rfunc (lbnd , ubnd , dtype = dt )
263
262
self .assertEqual (sample .dtype , np .dtype (dt ))
264
263
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
268
267
269
268
# gh-7284: Ensure that we get Python data types
270
269
sample = self .rfunc (lbnd , ubnd , dtype = dt )
@@ -527,7 +526,7 @@ def test_dirichlet_size(self):
527
526
assert_equal (rnd .dirichlet (p , (2 , 2 )).shape , (2 , 2 , 2 ))
528
527
assert_equal (rnd .dirichlet (p , np .array ((2 , 2 ))).shape , (2 , 2 , 2 ))
529
528
530
- assert_raises (TypeError , rnd .dirichlet , p , np .float (1 ))
529
+ assert_raises (TypeError , rnd .dirichlet , p , np .float64 (1 ))
531
530
532
531
533
532
def test_exponential (self ):
0 commit comments