@@ -49,7 +49,7 @@ def sanity_check(x1, x2):
49
49
except ValueError :
50
50
raise RuntimeError ("Error in test generation (probably a bug in the test suite" )
51
51
52
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
52
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
53
53
def test_abs (x ):
54
54
if dh .is_int_dtype (x .dtype ):
55
55
minval = dh .dtype_ranges [x .dtype ][0 ]
@@ -66,7 +66,7 @@ def test_abs(x):
66
66
# abs(x) = x for x >= 0
67
67
ah .assert_exactly_equal (a [ah .logical_not (less_zero )], x [ah .logical_not (less_zero )])
68
68
69
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
69
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
70
70
def test_acos (x ):
71
71
a = xp .acos (x )
72
72
ONE = ah .one (x .shape , x .dtype )
@@ -80,7 +80,7 @@ def test_acos(x):
80
80
# nan, which is already tested in the special cases.
81
81
ah .assert_exactly_equal (domain , codomain )
82
82
83
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
83
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
84
84
def test_acosh (x ):
85
85
a = xp .acosh (x )
86
86
ONE = ah .one (x .shape , x .dtype )
@@ -102,7 +102,7 @@ def test_add(x1, x2):
102
102
ah .assert_exactly_equal (a , b )
103
103
# TODO: Test that add is actually addition
104
104
105
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
105
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
106
106
def test_asin (x ):
107
107
a = xp .asin (x )
108
108
ONE = ah .one (x .shape , x .dtype )
@@ -113,7 +113,7 @@ def test_asin(x):
113
113
# mapped to nan, which is already tested in the special cases.
114
114
ah .assert_exactly_equal (domain , codomain )
115
115
116
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
116
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
117
117
def test_asinh (x ):
118
118
a = xp .asinh (x )
119
119
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -123,7 +123,7 @@ def test_asinh(x):
123
123
# mapped to nan, which is already tested in the special cases.
124
124
ah .assert_exactly_equal (domain , codomain )
125
125
126
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
126
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
127
127
def test_atan (x ):
128
128
a = xp .atan (x )
129
129
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -170,7 +170,7 @@ def test_atan2(x1, x2):
170
170
ah .assert_exactly_equal (ah .logical_or (ah .logical_and (negx1 , posx2 ),
171
171
ah .logical_and (negx1 , negx2 )), nega )
172
172
173
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
173
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
174
174
def test_atanh (x ):
175
175
a = xp .atanh (x )
176
176
ONE = ah .one (x .shape , x .dtype )
@@ -230,7 +230,7 @@ def test_bitwise_left_shift(x1, x2):
230
230
vals_shift = ah .int_to_dtype (vals_shift , dh .dtype_nbits [out .dtype ], dh .dtype_signed [out .dtype ])
231
231
assert vals_shift == res
232
232
233
- @given (xps .arrays (dtype = hh .integer_or_boolean_dtypes , shape = hh .shapes ))
233
+ @given (xps .arrays (dtype = hh .integer_or_boolean_dtypes , shape = hh .shapes () ))
234
234
def test_bitwise_invert (x ):
235
235
out = xp .bitwise_invert (x )
236
236
# Compare against the Python ~ operator.
@@ -322,7 +322,7 @@ def test_bitwise_xor(x1, x2):
322
322
vals_xor = ah .int_to_dtype (vals_xor , dh .dtype_nbits [out .dtype ], dh .dtype_signed [out .dtype ])
323
323
assert vals_xor == res
324
324
325
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
325
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
326
326
def test_ceil (x ):
327
327
# This test is almost identical to test_floor()
328
328
a = xp .ceil (x )
@@ -333,7 +333,7 @@ def test_ceil(x):
333
333
integers = ah .isintegral (x )
334
334
ah .assert_exactly_equal (a [integers ], x [integers ])
335
335
336
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
336
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
337
337
def test_cos (x ):
338
338
a = xp .cos (x )
339
339
ONE = ah .one (x .shape , x .dtype )
@@ -344,7 +344,7 @@ def test_cos(x):
344
344
# to nan, which is already tested in the special cases.
345
345
ah .assert_exactly_equal (domain , codomain )
346
346
347
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
347
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
348
348
def test_cosh (x ):
349
349
a = xp .cosh (x )
350
350
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -379,7 +379,7 @@ def test_equal(x1, x2):
379
379
380
380
# First we broadcast the arrays so that they can be indexed uniformly.
381
381
# TODO: it should be possible to skip this step if we instead generate
382
- # indices to x1 and x2 that correspond to the broadcasted hh. shapes. This
382
+ # indices to x1 and x2 that correspond to the broadcasted shapes. This
383
383
# would avoid the dependence in this test on broadcast_to().
384
384
shape = broadcast_shapes (x1 .shape , x2 .shape )
385
385
_x1 = xp .broadcast_to (x1 , shape )
@@ -414,7 +414,7 @@ def test_equal(x1, x2):
414
414
assert aidx .shape == x1idx .shape == x2idx .shape
415
415
assert bool (aidx ) == (scalar_func (x1idx ) == scalar_func (x2idx ))
416
416
417
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
417
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
418
418
def test_exp (x ):
419
419
a = xp .exp (x )
420
420
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -425,7 +425,7 @@ def test_exp(x):
425
425
# mapped to nan, which is already tested in the special cases.
426
426
ah .assert_exactly_equal (domain , codomain )
427
427
428
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
428
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
429
429
def test_expm1 (x ):
430
430
a = xp .expm1 (x )
431
431
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -436,7 +436,7 @@ def test_expm1(x):
436
436
# mapped to nan, which is already tested in the special cases.
437
437
ah .assert_exactly_equal (domain , codomain )
438
438
439
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
439
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
440
440
def test_floor (x ):
441
441
# This test is almost identical to test_ceil
442
442
a = xp .floor (x )
@@ -529,7 +529,7 @@ def test_greater_equal(x1, x2):
529
529
assert aidx .shape == x1idx .shape == x2idx .shape
530
530
assert bool (aidx ) == (scalar_func (x1idx ) >= scalar_func (x2idx ))
531
531
532
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
532
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
533
533
def test_isfinite (x ):
534
534
a = ah .isfinite (x )
535
535
TRUE = ah .true (x .shape )
@@ -545,7 +545,7 @@ def test_isfinite(x):
545
545
s = float (x [idx ])
546
546
assert bool (a [idx ]) == math .isfinite (s )
547
547
548
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
548
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
549
549
def test_isinf (x ):
550
550
a = xp .isinf (x )
551
551
FALSE = ah .false (x .shape )
@@ -560,7 +560,7 @@ def test_isinf(x):
560
560
s = float (x [idx ])
561
561
assert bool (a [idx ]) == math .isinf (s )
562
562
563
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
563
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
564
564
def test_isnan (x ):
565
565
a = ah .isnan (x )
566
566
FALSE = ah .false (x .shape )
@@ -633,7 +633,7 @@ def test_less_equal(x1, x2):
633
633
assert aidx .shape == x1idx .shape == x2idx .shape
634
634
assert bool (aidx ) == (scalar_func (x1idx ) <= scalar_func (x2idx ))
635
635
636
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
636
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
637
637
def test_log (x ):
638
638
a = xp .log (x )
639
639
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -644,7 +644,7 @@ def test_log(x):
644
644
# mapped to nan, which is already tested in the special cases.
645
645
ah .assert_exactly_equal (domain , codomain )
646
646
647
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
647
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
648
648
def test_log1p (x ):
649
649
a = xp .log1p (x )
650
650
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -655,7 +655,7 @@ def test_log1p(x):
655
655
# mapped to nan, which is already tested in the special cases.
656
656
ah .assert_exactly_equal (domain , codomain )
657
657
658
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
658
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
659
659
def test_log2 (x ):
660
660
a = xp .log2 (x )
661
661
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -666,7 +666,7 @@ def test_log2(x):
666
666
# mapped to nan, which is already tested in the special cases.
667
667
ah .assert_exactly_equal (domain , codomain )
668
668
669
- @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes ))
669
+ @given (xps .arrays (dtype = xps .floating_dtypes (), shape = hh .shapes () ))
670
670
def test_log10 (x ):
671
671
a = xp .log10 (x )
672
672
INFINITY = ah .infinity (x .shape , x .dtype )
@@ -698,7 +698,7 @@ def test_logical_and(x1, x2):
698
698
for idx in ah .ndindex (shape ):
699
699
assert a [idx ] == (bool (_x1 [idx ]) and bool (_x2 [idx ]))
700
700
701
- @given (xps .arrays (dtype = xp .bool , shape = hh .shapes ))
701
+ @given (xps .arrays (dtype = xp .bool , shape = hh .shapes () ))
702
702
def test_logical_not (x ):
703
703
a = ah .logical_not (x )
704
704
@@ -740,7 +740,7 @@ def test_multiply(x1, x2):
740
740
# multiply is commutative
741
741
ah .assert_exactly_equal (a , b )
742
742
743
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
743
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
744
744
def test_negative (x ):
745
745
out = ah .negative (x )
746
746
@@ -790,7 +790,7 @@ def test_not_equal(x1, x2):
790
790
assert bool (aidx ) == (scalar_func (x1idx ) != scalar_func (x2idx ))
791
791
792
792
793
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
793
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
794
794
def test_positive (x ):
795
795
out = xp .positive (x )
796
796
# Positive does nothing
@@ -817,7 +817,7 @@ def test_remainder(x1, x2):
817
817
not_nan = ah .logical_not (ah .logical_or (ah .isnan (out ), ah .isnan (x2 )))
818
818
ah .assert_same_sign (out [not_nan ], x2 [not_nan ])
819
819
820
- @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes ))
820
+ @given (xps .arrays (dtype = xps .numeric_dtypes (), shape = hh .shapes () ))
821
821
def test_round (x ):
822
822
a = xp .round (x )
823
823
0 commit comments