@@ -409,43 +409,20 @@ def test_full_like(x, fill_value, kw):
409
409
finite_kw = {"allow_nan" : False , "allow_infinity" : False }
410
410
411
411
412
- def int_stops (
413
- start : int , num , dtype : DataType , endpoint : bool
414
- ) -> st .SearchStrategy [int ]:
415
- min_gap = num
416
- if endpoint :
417
- min_gap += 1
418
- m , M = dh .dtype_ranges [dtype ]
419
- max_pos_gap = M - start
420
- max_neg_gap = start - m
421
- max_pos_mul = max_pos_gap // min_gap
422
- max_neg_mul = max_neg_gap // min_gap
423
- return st .one_of (
424
- st .integers (0 , max_pos_mul ).map (lambda n : start + min_gap * n ),
425
- st .integers (0 , max_neg_mul ).map (lambda n : start - min_gap * n ),
426
- )
427
-
428
-
429
412
@given (
430
413
num = hh .sizes ,
431
- dtype = st .none () | xps .numeric_dtypes (),
414
+ dtype = st .none () | xps .floating_dtypes (),
432
415
endpoint = st .booleans (),
433
416
data = st .data (),
434
417
)
435
418
def test_linspace (num , dtype , endpoint , data ):
436
419
_dtype = dh .default_float if dtype is None else dtype
437
420
438
421
start = data .draw (xps .from_dtype (_dtype , ** finite_kw ), label = "start" )
439
- if dh .is_float_dtype (_dtype ):
440
- stop = data .draw (xps .from_dtype (_dtype , ** finite_kw ), label = "stop" )
441
- # avoid overflow errors
442
- assume (not ah .isnan (ah .asarray (stop - start , dtype = _dtype )))
443
- assume (not ah .isnan (ah .asarray (start - stop , dtype = _dtype )))
444
- else :
445
- if num == 0 :
446
- stop = start
447
- else :
448
- stop = data .draw (int_stops (start , num , _dtype , endpoint ), label = "stop" )
422
+ stop = data .draw (xps .from_dtype (_dtype , ** finite_kw ), label = "stop" )
423
+ # avoid overflow errors
424
+ assume (not ah .isnan (ah .asarray (stop - start , dtype = _dtype )))
425
+ assume (not ah .isnan (ah .asarray (start - stop , dtype = _dtype )))
449
426
450
427
kw = data .draw (
451
428
hh .specified_kwargs (
0 commit comments